Changeset 305

Show
Ignore:
Timestamp:
08/06/08 04:06:42 (4 years ago)
Author:
john
Message:

updating package make

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/README

    r303 r305  
    2929From the commandline run the following command: 
    3030php makepkg.php 
     31(Disregard any warning messages that say "not prefixed with package name "PHPonTrax"") 
    3132After that runs it will make a build folder with the PEAR module called: 
    3233PHPonTrax-<version>.tgz  
     
    3435pear install -a PHPonTrax-<version>.tgz 
    3536If you have a previously installed version exists first run: 
    36 pear uninstall PHPonTrax 
     37pear uninstall trax/PHPonTrax 
    3738 
    3839== Getting Started 
  • trunk/makepkg.php

    r303 r305  
    6161    'packagedirectory' => '.', 
    6262    'filelistgenerator' => 'svn', // generate from svn or file 
     63    'simpleoutput' => true, 
    6364    'dir_roles' => array( 
    6465        'doc' => 'doc', 
  • trunk/trax/trax.php

    r227 r305  
    4848function trax() { 
    4949 
    50     global $search, $replace; 
     50    global $search, $replace, $quiet; 
    5151 
    5252    //  Get command line argument, if any 
    53     if (!array_key_exists('argc',$GLOBALS) 
    54         || ($GLOBALS['argc'] < 2)) { 
    55         usage();                // print Usage message and exit 
    56     } 
     53    if (!array_key_exists('argc',$GLOBALS) || ($GLOBALS['argc'] < 2)) { 
     54        usage(); // print Usage message and exit 
     55    } 
     56 
     57    $first_param_is_option = (substr($GLOBALS['argv'][1], 0, 1) == "-") ? true : false; 
    5758 
    5859    //  Check for excess arguments 
    59     if ($GLOBALS['argc'] > 2) { 
     60    if ($GLOBALS['argc'] > 3 && !$first_param_is_option) { 
    6061        echo "unrecognized command argument ".$GLOBALS['argv'][2]."\n"; 
    6162        usage(); 
    6263    } 
    6364 
    64     //  Destination directory on command line 
    65     $dstdir = $GLOBALS['argv'][1]; 
     65    if($first_param_is_option) { 
     66        foreach($GLOBALS['argv'] as $arg) { 
     67            if($arg == '-v' || $arg == '--version') { 
     68                include(dirname(__FILE__)."/vendor/trax/trax.php"); 
     69                echo "Trax ".Trax::version()."\n"; 
     70                exit; 
     71            } elseif($arg == '-h' || $arg == '--help') { 
     72                usage(); 
     73            } 
     74        }        
     75    } else { 
     76        //  Destination directory on command line 
     77        $dstdir = $GLOBALS['argv'][1];   
     78        if($GLOBALS['argv'][2] == '-q' || $GLOBALS['argv'][2] == '--quiet') { 
     79            $quiet = true;           
     80        } 
     81    } 
    6682 
    6783    //  Guarantee it ends with DIRECTORY_SEPARATOR 
     
    8197    $srcdir = SOURCE_DIR; 
    8298    //  copy source directory to destination directory 
    83     copy_dir($srcdir,$dstdir); 
     99    copy_dir($srcdir, $dstdir); 
    84100} 
    85101 
     
    93109 *  @return boolean true=>success, false=>failure. 
    94110 */ 
    95 function copy_dir($src_path,$dst_path) { 
     111function copy_dir($src_path, $dst_path) { 
     112     
     113    global $quiet; 
    96114 
    97115    //  Make sure we have directories as arguments 
     
    135153                    if ($src_content == $dst_content) { 
    136154                        //  Source and destination are identical 
    137                         echo "$dst_path$src_file exists\n"; 
     155                        if(!$quiet) echo "\texists $dst_path$src_file\n"; 
    138156                        continue; 
    139157                    } 
     
    147165                    return false; 
    148166                } 
    149                 echo "renamed $dst_path$src_file to $new_name\n"; 
     167                if(!$quiet) echo "\trenamed $src_file to ".($src_file.'.'.$stat[9])."\n"; 
    150168            } 
    151169 
     
    165183            }            
    166184 
    167             echo  "$dst_path$src_file created\n"; 
     185            if(!$quiet) echo "\tcreate $dst_path$src_file\n"; 
    168186        } else { 
    169187 
     
    172190                continue; 
    173191            } 
     192 
    174193            //  This directory needs to be copied. 
    175194            if (!create_dir( $dst_path . $src_file )) { 
     
    186205    closedir($src_handle); 
    187206    return true; 
    188 }                               // function copy_dir() 
     207} 
    189208 
    190209/** 
    191210 *  Create a directory if it doesn't exist 
    192211 *  @param string $dst_dir  Path of directory to create 
     212 *  @param string $perms Chmod permissions (0775) 
    193213 *  @return boolean  true=>success, false=>failed 
    194214 */ 
    195215function create_dir($dst_dir) { 
     216     
     217    global $quiet; 
    196218 
    197219    //  Does a directory of this name exist? 
     
    202224 
    203225            //  A destination directory with this name exists. 
    204             echo "$dst_dir".DIRECTORY_SEPARATOR." exists\n"; 
     226            if(!$quiet) echo "\texists $dst_dir\n"; 
    205227            return true; 
    206228        } 
     
    211233        $stat = stat($dst_dir); 
    212234        $new_name = $dst_dir.'.'.$stat[9]; 
    213         if (!rename($dst_dir,$new_name)) { 
     235        if (!rename($dst_dir, $new_name)) { 
    214236            echo "unable to rename $dst_dir to $new_name\n"; 
    215237            return false; 
    216238        } 
    217         echo "renamed $dst_dir to $new_name\n"; 
     239        if(!$quiet) echo "\trenamed $dst_dir to $new_name\n"; 
    218240    } 
    219241 
    220242    //  Destination directory does not exist.  Create it 
    221     if (!mkdir($dst_dir,0775,true)) { 
    222         return false; 
    223     } 
    224     echo "$dst_dir".DIRECTORY_SEPARATOR." created\n"; 
     243    if (!mkdir($dst_dir, 0775, true)) { 
     244        return false; 
     245    } 
     246    if(!$quiet) echo "\tcreate ".$dst_dir."\n"; 
    225247    return true; 
    226248} 
     
    256278    echo "Usage: @BIN-DIR@".DIRECTORY_SEPARATOR."trax" 
    257279        ." ".DIRECTORY_SEPARATOR."path".DIRECTORY_SEPARATOR."to" 
    258         .DIRECTORY_SEPARATOR."your".DIRECTORY_SEPARATOR."app 
     280        .DIRECTORY_SEPARATOR."your".DIRECTORY_SEPARATOR."app [options] 
     281 
     282Options: 
     283    -q, --quiet         Suppress normal output. 
     284    -v, --version           Show the Trax version number and quit. 
     285    -h, --help          Show this help message and quit. 
    259286 
    260287Description: