Exemplo n.º 1
0
 /**
  * @param PharComposer $pharcomposer
  * @depends testConstructor
  */
 public function testSetters(PharComposer $pharcomposer)
 {
     $pharcomposer->setMain('example/phar-composer.php');
     $this->assertEquals('example/phar-composer.php', $pharcomposer->getMain());
     $pharcomposer->setTarget('test.phar');
     $this->assertEquals('test.phar', $pharcomposer->getTarget());
     return $pharcomposer;
 }
Exemplo n.º 2
0
 protected function doBuild(Builder $builder, Packager $packager, PharComposer $pharer)
 {
     $pulsate = $builder->pulsate('Waiting for target file name...')->run();
     $save = $builder->fileSave('Location to write file to', $pharer->getTarget());
     $target = $save->waitReturn();
     if ($target === false) {
         return;
     }
     $pulsate->close();
     $pulsate = $builder->pulsate('Building target file...')->run();
     $pharer->setTarget($target);
     $pharer->build();
     $pulsate->close();
 }
Exemplo n.º 3
0
 public function getSystemBin(PharComposer $pharer, $path = null)
 {
     // no path given => place in system bin path
     if ($path === null) {
         $path = self::PATH_BIN;
     }
     // no slash => path is relative to system bin path
     if (strpos($path, '/') === false) {
         $path = self::PATH_BIN . '/' . $path;
     }
     // TODO: check path is in $PATH environment
     // path is actually a directory => append package name
     if (is_dir($path)) {
         $path = rtrim($path, '/') . '/' . basename($pharer->getTarget(), '.phar');
     }
     return $path;
 }