release 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. require 'paths.php';
  3. require 'laravel/core.php';
  4. require 'vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
  5. use Symfony\Component\ClassLoader\UniversalClassLoader;
  6. $loader = new UniversalClassLoader;
  7. $loader->register();
  8. $loader->registerNamespace('Symfony', __DIR__.'/vendor');
  9. use Laravel\File;
  10. use Symfony\Component\Console\Application;
  11. use Symfony\Component\Console\Command\Command;
  12. use Symfony\Component\Console\Input\InputArgument;
  13. use Symfony\Component\Console\Input\InputInterface;
  14. use Symfony\Component\Console\Output\OutputInterface;
  15. $console = new Application;
  16. class TestingReleaser extends Command {
  17. /**
  18. * Configure the console command.
  19. *
  20. * @return void
  21. */
  22. protected function configure()
  23. {
  24. $this->setName('testing:release')->setDescription('Release to testing');
  25. }
  26. /**
  27. * Merge the develop branch into testing.
  28. *
  29. * return void
  30. */
  31. public function execute(InputInterface $input, OutputInterface $output)
  32. {
  33. passthru('git checkout testing');
  34. passthru('git merge develop');
  35. File::rmdir(__DIR__.'/tests');
  36. @unlink(__DIR__.'/phpunit.php');
  37. @unlink(__DIR__.'/phpunit.xml');
  38. passthru('git commit -am "<auto> removed unit tests from repository."');
  39. }
  40. }
  41. class DevelopHotfixer extends Command {
  42. /**
  43. * Configure the console command.
  44. *
  45. * @return void
  46. */
  47. public function configure()
  48. {
  49. $this->setName('develop:hotfix')->setDescription('Bring hotfixes into develop');
  50. }
  51. /**
  52. * Merge the testing and master branch hotfixes into the develop branch.
  53. *
  54. * @return void
  55. */
  56. public function execute(InputInterface $input, OutputInterface $output)
  57. {
  58. passthru('git checkout develop');
  59. File::cpdir(__DIR__.'/tests', __DIR__.'/tests_bkp');
  60. File::copy(__DIR__.'/phpunit.php', __DIR__.'/phpunit_bkp.php');
  61. File::copy(__DIR__.'/phpunit.xml', __DIR__.'/phpunit_bkp.xml');
  62. passthru('git merge testing');
  63. File::rmdir(__DIR__.'/tests');
  64. @unlink(__DIR__.'/phpunit.php');
  65. @unlink(__DIR__.'/phpunit.xml');
  66. File::cpdir(__DIR__.'/tests_bkp', __DIR__.'/tests');
  67. File::copy(__DIR__.'/phpunit_bkp.php', __DIR__.'/phpunit.php');
  68. File::copy(__DIR__.'/phpunit_bkp.xml', __DIR__.'/phpunit.xml');
  69. File::rmdir(__DIR__.'/tests_bkp');
  70. @unlink(__DIR__.'/phpunit_bkp.php');
  71. @unlink(__DIR__.'/phpunit_bkp.xml');
  72. passthru('git add .');
  73. passthru('git commit -am "<auto> merging hotfixes. re-added tests into repository."');
  74. }
  75. }
  76. $console->add(new TestingReleaser);
  77. $console->add(new DevelopHotfixer);
  78. $console->run();