CruiseServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
eloc 22
dl 0
loc 52
rs 10
c 4
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A boot() 0 38 2
1
<?php
2
3
namespace Sfneal\Cruise\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Sfneal\Cruise\Commands\Bump;
7
use Sfneal\Cruise\Commands\CruiseInstall;
8
use Sfneal\Cruise\Commands\CruiseUninstall;
9
use Sfneal\Cruise\Commands\MigrateDbInProduction;
10
use Sfneal\Cruise\Commands\Version;
11
use Sfneal\Cruise\Commands\WaitForDb;
12
13
class CruiseServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap any Users services.
17
     */
18
    public function boot(): void
19
    {
20
        // Publish config file
21
        $this->publishes([
22
            __DIR__.'/../../config/cruise.php' => config_path('cruise.php'),
23
        ], ['config', 'cruise-config']);
24
25
        // Load commands
26
        if ($this->app->runningInConsole()) {
27
            $this->commands([
28
                // DB commands
29
                MigrateDbInProduction::class,
30
                WaitForDb::class,
31
32
                // Semver bump commands
33
                Bump::class,
34
                Version::class,
35
36
                // Install/uninstall command
37
                CruiseInstall::class,
38
                CruiseUninstall::class,
39
            ]);
40
        }
41
42
        // Docker compose & dockerfiles
43
        $this->publishes([
44
            __DIR__.'/../../docker/services' => base_path(''),
45
        ], 'docker');
46
47
        // Supervisor configs
48
        $this->publishes([
49
            __DIR__.'/../../docker/supervisor' => base_path('docker/supervisor'),
50
        ], 'docker');
51
52
        // Docker scripts configs
53
        $this->publishes([
54
            __DIR__.'/../../docker/scripts' => base_path('docker/scripts'),
55
        ], 'docker');
56
    }
57
58
    /**
59
     * Register any Users services.
60
     */
61
    public function register(): void
62
    {
63
        // Load config file
64
        $this->mergeConfigFrom(__DIR__.'/../../config/cruise.php', 'cruise');
65
    }
66
}
67