<?php namespace Bob\BuildConfig; task("default", array("test")); desc("Runs all tests."); task("test", array("phpunit.xml", "composer.json"), function () { sh("./vendor/bin/phpunit"); }); fileTask("phpunit.xml", array("phpunit.dist.xml"), function ($task) { copy($task->prerequisites[0], $task->name); }); fileTask("composer.json", array("composer.lock"), function ($task) { if (!file_exists("composer.phar")) { file_put_contents("composer.phar", file_get_contents("http://getcomposer.org/composer.phar")); } php("composer.phar install --dev"); });
<?php /* * Put the `bob_config.php` into the "Bob" namespace, * otherwise you would've to call the `task` and * `desc` functions with a `Bob\` prefix. */ namespace Bob\BuildConfig; task('default', array('test')); desc("Runs all tests"); task('test', array('composer.lock'), function () { if (!file_exists('phpunit.xml')) { copy('phpunit.dist.xml', 'phpunit.xml'); } echo sh('phpunit'); }); desc('Runs "composer update" when the composer.json was changed'); fileTask('composer.lock', array('composer.json'), function ($task) { echo sh('composer update'); });
<?php namespace Bob; task('default', array('test')); task('test', array('phpunit.xml'), function () { sh('phpunit'); }); fileTask('phpunit.xml', array('phpunit.xml.dist'), function ($task) { copy($task->prerequisites[0], $task->name); });
<?php namespace Bob\BuildConfig; task('default', array('test')); task('test', array('phpunit.xml'), function () { echo `phpunit`; }); fileTask('phpunit.xml', array('phpunit.dist.xml'), function () { copy('phpunit.dist.xml', 'phpunit.xml'); });
<?php namespace Bob; task("default", ["test"]); desc("Runs PHPUnit Test Suite"); task("test", ["phpunit.xml"], function () { sh("phpunit"); }); desc("Converts the README to markdown and opens the result in the browser."); task("readme", function () { `redcarpet README.md > README.html`; `open README.html`; }); fileTask("phpunit.xml", ["phpunit.dist.xml"], function () { copy("phpunit.dist.xml", "phpunit.xml"); });