Beispiel #1
0
    $stub = <<<'EOF'
#!/usr/bin/env php
<?php

Phar::mapPhar('bob.phar');

require 'phar://bob.phar/bin/bootstrap.php';

__HALT_COMPILER();
EOF;
    $projectDir = \Bob::$application->projectDirectory;
    $phar = new \Phar($task->name, 0, basename($task->name));
    $phar->startBuffering();
    foreach ($task->prerequisites as $file) {
        $file = (string) $file;
        $phar->addFile($file, Path::relativize($file, $projectDir));
    }
    $phar->setStub($stub);
    $phar->stopBuffering();
    chmod($task->name, 0555);
    println(sprintf('Regenerated Archive "%s" with %d entries', basename($task->name), count($phar)));
    unset($phar);
});
desc('Does a system install of Bob, by default to /usr/local/bin');
task('install', array('bin/bob.phar'), function ($task) {
    $prefix = getenv('PREFIX') ?: '/usr/local';
    $success = copy('bin/bob.phar', "{$prefix}/bin/bob");
    chmod("{$prefix}/bin/bob", 0755);
    println(sprintf('Installed the `bob` executable in %s.', $prefix));
});
desc('Removes the `bob` excutable from the PREFIX');
Beispiel #2
0
 /**
  * @dataProvider testRelativizeProvider
  */
 function testRelativize($expected, $absolute)
 {
     $this->assertEquals($expected, Path::relativize($absolute, __DIR__));
 }