Changeset 305
- Timestamp:
- 08/06/08 04:06:42 (4 years ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
README (modified) (2 diffs)
-
makepkg.php (modified) (1 diff)
-
trax/trax.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r303 r305 29 29 From the commandline run the following command: 30 30 php makepkg.php 31 (Disregard any warning messages that say "not prefixed with package name "PHPonTrax"") 31 32 After that runs it will make a build folder with the PEAR module called: 32 33 PHPonTrax-<version>.tgz … … 34 35 pear install -a PHPonTrax-<version>.tgz 35 36 If you have a previously installed version exists first run: 36 pear uninstall PHPonTrax37 pear uninstall trax/PHPonTrax 37 38 38 39 == Getting Started -
trunk/makepkg.php
r303 r305 61 61 'packagedirectory' => '.', 62 62 'filelistgenerator' => 'svn', // generate from svn or file 63 'simpleoutput' => true, 63 64 'dir_roles' => array( 64 65 'doc' => 'doc', -
trunk/trax/trax.php
r227 r305 48 48 function trax() { 49 49 50 global $search, $replace ;50 global $search, $replace, $quiet; 51 51 52 52 // 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; 57 58 58 59 // Check for excess arguments 59 if ($GLOBALS['argc'] > 2) {60 if ($GLOBALS['argc'] > 3 && !$first_param_is_option) { 60 61 echo "unrecognized command argument ".$GLOBALS['argv'][2]."\n"; 61 62 usage(); 62 63 } 63 64 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 } 66 82 67 83 // Guarantee it ends with DIRECTORY_SEPARATOR … … 81 97 $srcdir = SOURCE_DIR; 82 98 // copy source directory to destination directory 83 copy_dir($srcdir, $dstdir);99 copy_dir($srcdir, $dstdir); 84 100 } 85 101 … … 93 109 * @return boolean true=>success, false=>failure. 94 110 */ 95 function copy_dir($src_path,$dst_path) { 111 function copy_dir($src_path, $dst_path) { 112 113 global $quiet; 96 114 97 115 // Make sure we have directories as arguments … … 135 153 if ($src_content == $dst_content) { 136 154 // Source and destination are identical 137 echo "$dst_path$src_file exists\n";155 if(!$quiet) echo "\texists $dst_path$src_file\n"; 138 156 continue; 139 157 } … … 147 165 return false; 148 166 } 149 echo "renamed $dst_path$src_file to $new_name\n";167 if(!$quiet) echo "\trenamed $src_file to ".($src_file.'.'.$stat[9])."\n"; 150 168 } 151 169 … … 165 183 } 166 184 167 echo "$dst_path$src_file created\n";185 if(!$quiet) echo "\tcreate $dst_path$src_file\n"; 168 186 } else { 169 187 … … 172 190 continue; 173 191 } 192 174 193 // This directory needs to be copied. 175 194 if (!create_dir( $dst_path . $src_file )) { … … 186 205 closedir($src_handle); 187 206 return true; 188 } // function copy_dir()207 } 189 208 190 209 /** 191 210 * Create a directory if it doesn't exist 192 211 * @param string $dst_dir Path of directory to create 212 * @param string $perms Chmod permissions (0775) 193 213 * @return boolean true=>success, false=>failed 194 214 */ 195 215 function create_dir($dst_dir) { 216 217 global $quiet; 196 218 197 219 // Does a directory of this name exist? … … 202 224 203 225 // A destination directory with this name exists. 204 echo "$dst_dir".DIRECTORY_SEPARATOR." exists\n";226 if(!$quiet) echo "\texists $dst_dir\n"; 205 227 return true; 206 228 } … … 211 233 $stat = stat($dst_dir); 212 234 $new_name = $dst_dir.'.'.$stat[9]; 213 if (!rename($dst_dir, $new_name)) {235 if (!rename($dst_dir, $new_name)) { 214 236 echo "unable to rename $dst_dir to $new_name\n"; 215 237 return false; 216 238 } 217 echo "renamed $dst_dir to $new_name\n";239 if(!$quiet) echo "\trenamed $dst_dir to $new_name\n"; 218 240 } 219 241 220 242 // 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"; 225 247 return true; 226 248 } … … 256 278 echo "Usage: @BIN-DIR@".DIRECTORY_SEPARATOR."trax" 257 279 ." ".DIRECTORY_SEPARATOR."path".DIRECTORY_SEPARATOR."to" 258 .DIRECTORY_SEPARATOR."your".DIRECTORY_SEPARATOR."app 280 .DIRECTORY_SEPARATOR."your".DIRECTORY_SEPARATOR."app [options] 281 282 Options: 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. 259 286 260 287 Description:
