update 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of php-restcord.
  5. *
  6. * (c) Aaron Scherer <aequasi@gmail.com>
  7. *
  8. * This source file is subject to the license that is bundled
  9. * with this source code in the file LICENSE
  10. */
  11. require __DIR__.'/../vendor/autoload.php';
  12. use Symfony\Component\Console\Application;
  13. use Symfony\Component\Console\Input\InputArgument;
  14. use Symfony\Component\Console\Input\InputInterface;
  15. use Symfony\Component\Console\Output\OutputInterface;
  16. use Symfony\Component\Console\Style\SymfonyStyle;
  17. use Symfony\Component\Process\Process;
  18. /** @noinspection PhpUnhandledExceptionInspection */
  19. (new Application('Updating', '1.0.0'))
  20. ->register('update')
  21. ->addArgument('version', InputArgument::REQUIRED, 'Version to build')
  22. ->setCode(
  23. function (InputInterface $input, OutputInterface $output) {
  24. $style = new SymfonyStyle($input, $output);
  25. $style->title("Building Docs for: ".$input->getArgument('version'));
  26. run($output, "./bin/downloadServiceDefinition -vvv " . $input->getArgument('version'));
  27. run($output, "./bin/buildDocs -vvv " . $input->getArgument('version'));
  28. run($output, "./bin/buildModelClasses -vvv " . $input->getArgument('version'));
  29. run($output, "./bin/buildDummyClasses -vvv " . $input->getArgument('version'));
  30. }
  31. )
  32. ->getApplication()
  33. ->setDefaultCommand('update', true)
  34. ->run();
  35. function run(OutputInterface $output, $process) {
  36. $process = new Process($process);
  37. $process->run(function ($type, $buffer) use ($output) {
  38. $output->write($buffer);
  39. });
  40. }