Changeset 225
- Timestamp:
- 02/06/07 11:50:51 (1 year ago)
- Files:
-
- trunk/build/star/build.xml (modified) (1 diff)
- trunk/build/stubbles/build.php (modified) (3 diffs)
- trunk/lib/xjconf.star (modified) (previous)
- trunk/src/main/php/net/stubbles/star/StarArchive.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/star/StarConsole.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/star/StarFile.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/star/build.xml
r218 r225 42 42 <echo message="Source directory: ${build.src.dir}"/> 43 43 44 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-writer-archive.ini" -t "${build.src.dir}/starWriter.php" " />45 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-writer-cli.ini" -t "${build.src.dir}/starWriter-cli.php" " />46 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-reader.ini" -t "${build.src.dir}/starReader.php" " />44 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-writer-archive.ini" -t "${build.src.dir}/starWriter.php" -r "${pkg.dir}"" /> 45 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-writer-cli.ini" -t "${build.src.dir}/starWriter-cli.php" -r "${pkg.dir}"" /> 46 <exec command="php "${project.basedir}/build.php" -i "${project.basedir}/compile-reader.ini" -t "${build.src.dir}/starReader.php" -r "${pkg.dir}"" /> 47 47 </target> 48 48 trunk/build/stubbles/build.php
r219 r225 16 16 $srcDir = 'src' . DIRECTORY_SEPARATOR . 'main' . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR; 17 17 $starArchive = new StarArchive(new StarWriter(dirname(__FILE__) . '/build/stubbles.php')); 18 $removePath = realpath(dirname(__FILE__) . '/../../'); 18 19 foreach ($dir as $file) { 19 20 foreach ($forbidden as $test) { … … 27 28 $id = str_replace(DIRECTORY_SEPARATOR, '.', str_replace('.php', '', substr($file->getPathname(), $pos))); 28 29 echo 'Adding ' . $id . "\n"; 29 $starArchive->add(new StarFile($file->getPathname() ), $id);30 $starArchive->add(new StarFile($file->getPathname(), $removePath), $id); 30 31 } 31 32 $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(dirname(__FILE__) . '/../../src/main/resources'))); … … 42 43 $id = str_replace(DIRECTORY_SEPARATOR, '/', substr($file->getPathname(), $pos)); 43 44 echo 'Adding ' . $id . "\n"; 44 $starArchive->add(new StarFile($file->getPathname() ), $id);45 $starArchive->add(new StarFile($file->getPathname(), $removePath), $id); 45 46 } 46 47 $starArchive->add(new StarFile(realpath(dirname(__FILE__) . '/../../src/main/php/net/stubbles/star/StarClassRegistry.php')), 'net.stubbles.star.StarClassRegistry'); trunk/src/main/php/net/stubbles/star/StarArchive.php
r218 r225 69 69 $data = $file->getContents(); 70 70 $this->index[$id] = array('basename' => $file->getBaseName(), 71 'path' => $file->getPath (),71 'path' => $file->getPathWithBaseRemoved(), 72 72 'datasize' => strlen($data), 73 73 'offset' => -1, trunk/src/main/php/net/stubbles/star/StarConsole.php
r137 r225 24 24 * @var array 25 25 */ 26 private static $config = array('target' => array('short' => 't', 27 'min' => 0, 28 'max' => 1, 29 'desc' => 'Name of the archive to create.', 30 'default' => '' 31 ), 32 'ini' => array('short' => 'i', 33 'min' => 0, 34 'max' => 1, 35 'desc' => 'Name of the ini file to use.', 36 'default' => '' 37 ), 38 'verbose' => array('short' => 'v', 39 'min' => 0, 40 'max' => 0, 41 'desc' => 'Be verbose.' 42 ) 26 private static $config = array('target' => array('short' => 't', 27 'min' => 0, 28 'max' => 1, 29 'desc' => 'Name of the archive to create.', 30 'default' => '' 31 ), 32 'ini' => array('short' => 'i', 33 'min' => 0, 34 'max' => 1, 35 'desc' => 'Name of the ini file to use.', 36 'default' => '' 37 ), 38 'removePath' => array('short' => 'r', 39 'min' => 0, 40 'max' => 1, 41 'desc' => 'Path to remove from logfiles.', 42 'default' => '' 43 ), 44 'verbose' => array('short' => 'v', 45 'min' => 0, 46 'max' => 0, 47 'desc' => 'Be verbose.' 48 ) 43 49 ); 44 50 /** … … 159 165 $this->verbose('Writing star data to ' . $target . "\n"); 160 166 $starArchive = new StarArchive(new StarWriter($target)); 167 $removePath = null; 168 if ($this->args->isDefined('removePath') == true) { 169 $removePath = $this->args->getValue('removePath'); 170 } 161 171 foreach ($conf['INCLUDES'] as $id => $fileName) { 162 172 $this->verbose('Include ' . $fileName . ' with id ' . $id . "\n"); 163 $starArchive->add(new StarFile($fileName ), $id);173 $starArchive->add(new StarFile($fileName, $removePath), $id); 164 174 } 165 175 trunk/src/main/php/net/stubbles/star/StarFile.php
r124 r225 20 20 protected $name; 21 21 22 protected $removePath = null; 23 22 24 /** 23 25 * constructor 24 26 * 25 * @param string $name name of the file 27 * @param string $name name of the file 28 * @param string $removePath optional part of the directory name that should be removed 26 29 */ 27 public function __construct($name )30 public function __construct($name, $removePath = null) 28 31 { 29 $this->name = $name; 32 $this->name = $name; 33 if (null !== $removePath) { 34 $this->removePath = realpath($removePath) . DIRECTORY_SEPARATOR; 35 } 30 36 } 31 37 … … 86 92 return dirname($this->name); 87 93 } 94 95 public function getPathWithBaseRemoved() 96 { 97 if (null !== $this->removePath) { 98 return str_replace(DIRECTORY_SEPARATOR, '/', str_replace($this->removePath, '', $this->getPath())); 99 } 100 101 return $this->getPath(); 102 } 88 103 89 104 /**
