1 | <?php |
||
15 | class InstallCommand extends Command |
||
16 | { |
||
17 | use UseComposer; |
||
18 | |||
19 | /** |
||
20 | * Get package name to install. |
||
21 | */ |
||
22 | protected function getPackageName() |
||
26 | |||
27 | /** |
||
28 | * Configure the command options. |
||
29 | */ |
||
30 | protected function configure() |
||
49 | |||
50 | /** |
||
51 | * Execute the command. |
||
52 | * |
||
53 | * @param InputInterface $input |
||
54 | * @param OutputInterface $output |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | protected function execute(InputInterface $input, OutputInterface $output) |
||
59 | { |
||
60 | $composer = $this->findComposer(); |
||
61 | |||
62 | $commands = [ |
||
63 | $composer.' require '.$this->getPackageName().$this->getDevSuffix($input), |
||
64 | $composer.' require --dev laravel/dusk', |
||
65 | ]; |
||
66 | |||
67 | if ($input->getOption('no-ansi')) { |
||
68 | $commands = array_map(function ($value) { |
||
69 | return $value.' --no-ansi'; |
||
70 | }, $commands); |
||
71 | } |
||
72 | |||
73 | $force = $input->getOption('dontforce') ? '' : ' --force'; |
||
74 | $commands = array_merge($commands, [ |
||
75 | 'php artisan dusk:install', |
||
76 | 'php artisan adminlte:publish'.$force, |
||
77 | ]); |
||
78 | |||
79 | $process = new Process( |
||
80 | $runningCommand = implode(' && ', $commands), |
||
81 | null, |
||
82 | null, |
||
83 | null, |
||
84 | null |
||
85 | ); |
||
86 | |||
87 | if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { |
||
88 | $process->setTty(true); |
||
89 | } |
||
90 | |||
91 | $output->writeln('<info>Running '.$runningCommand.'</info>'); |
||
92 | $process->run(function ($type, $line) use ($output) { |
||
93 | $output->write($line); |
||
94 | }); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * Gets dev suffix. |
||
99 | * |
||
100 | * @param InputInterface $input |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | private function getDevSuffix(InputInterface $input) |
||
108 | } |
||
109 |