InitDependence.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Symfony\Component\Process\Process;
  5. use Symfony\Component\Process\Exception\ProcessFailedException;
  6. class InitDependence extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'init:dep';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'init dependence date - pali sencence ect.';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. if(\App\Tools\Tools::isStop()){
  37. return 0;
  38. }
  39. #克隆依赖的数据仓库到本地
  40. $depDir = $this->info(config("mint.path.dependence"));
  41. foreach ($this->info(config("mint.dependence")) as $key => $value) {
  42. # code...
  43. $process = new Process(['git','clone',$value->url,$depDir.'/'.$value->path]);
  44. $process->run();
  45. if(!$process->isSuccessful()){
  46. throw new ProcessFailedException($process);
  47. }
  48. $this->info($process->getOutput());
  49. }
  50. return 0;
  51. }
  52. }