InitDependence.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #克隆依赖的数据仓库到本地
  37. $depDir = $this->info(config("mint.path.dependence"));
  38. foreach ($this->info(config("mint.dependence")) as $key => $value) {
  39. # code...
  40. $process = new Process(['git','clone',$value->url,$depDir.'/'.$value->path]);
  41. $process->run();
  42. if(!$process->isSuccessful()){
  43. throw new ProcessFailedException($process);
  44. }
  45. $this->info($process->getOutput());
  46. }
  47. return 0;
  48. }
  49. }