register(); $loader->registerNamespace('Symfony', __DIR__.'/vendor'); use Laravel\File; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; $console = new Application; class TestingReleaser extends Command { /** * Configure the console command. * * @return void */ protected function configure() { $this->setName('testing:release')->setDescription('Release to testing'); } /** * Merge the develop branch into testing. * * return void */ public function execute(InputInterface $input, OutputInterface $output) { passthru('git checkout testing'); passthru('git merge develop'); File::rmdir(__DIR__.'/tests'); @unlink(__DIR__.'/phpunit.php'); @unlink(__DIR__.'/phpunit.xml'); passthru('git commit -am " removed unit tests from repository."'); } } class DevelopHotfixer extends Command { /** * Configure the console command. * * @return void */ public function configure() { $this->setName('develop:hotfix')->setDescription('Bring hotfixes into develop'); } /** * Merge the testing and master branch hotfixes into the develop branch. * * @return void */ public function execute(InputInterface $input, OutputInterface $output) { passthru('git checkout develop'); File::cpdir(__DIR__.'/tests', __DIR__.'/tests_bkp'); File::copy(__DIR__.'/phpunit.php', __DIR__.'/phpunit_bkp.php'); File::copy(__DIR__.'/phpunit.xml', __DIR__.'/phpunit_bkp.xml'); passthru('git merge testing'); File::rmdir(__DIR__.'/tests'); @unlink(__DIR__.'/phpunit.php'); @unlink(__DIR__.'/phpunit.xml'); File::cpdir(__DIR__.'/tests_bkp', __DIR__.'/tests'); File::copy(__DIR__.'/phpunit_bkp.php', __DIR__.'/phpunit.php'); File::copy(__DIR__.'/phpunit_bkp.xml', __DIR__.'/phpunit.xml'); File::rmdir(__DIR__.'/tests_bkp'); @unlink(__DIR__.'/phpunit_bkp.php'); @unlink(__DIR__.'/phpunit_bkp.xml'); } } $console->add(new TestingReleaser); $console->add(new DevelopHotfixer); $console->run();