Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 399 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Laravel\Sail\Console;
4
 
5
use Illuminate\Console\Command;
6
use RuntimeException;
7
use Symfony\Component\Process\Process;
8
 
9
class InstallCommand extends Command
10
{
621 lars 11
    use Concerns\InteractsWithDockerComposeServices;
12
 
148 lars 13
    /**
14
     * The name and signature of the console command.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'sail:install
19
                {--with= : The services that should be included in the installation}
20
                {--devcontainer : Create a .devcontainer configuration directory}';
21
 
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Install Laravel Sail\'s default Docker Compose file';
28
 
29
    /**
30
     * Execute the console command.
31
     *
32
     * @return int|null
33
     */
34
    public function handle()
35
    {
36
        if ($this->option('with')) {
37
            $services = $this->option('with') == 'none' ? [] : explode(',', $this->option('with'));
38
        } elseif ($this->option('no-interaction')) {
621 lars 39
            $services = $this->defaultServices;
148 lars 40
        } else {
41
            $services = $this->gatherServicesWithSymfonyMenu();
42
        }
43
 
44
        if ($invalidServices = array_diff($services, $this->services)) {
45
            $this->error('Invalid services ['.implode(',', $invalidServices).'].');
46
 
47
            return 1;
48
        }
49
 
50
        $this->buildDockerCompose($services);
51
        $this->replaceEnvVariables($services);
52
        $this->configurePhpUnit();
53
 
54
        if ($this->option('devcontainer')) {
55
            $this->installDevContainer();
56
        }
57
 
58
        $this->info('Sail scaffolding installed successfully.');
59
 
60
        $this->prepareInstallation($services);
61
    }
62
}