1 | <?php |
||
9 | class AddonListCommand extends Command |
||
10 | { |
||
11 | use Functions; |
||
12 | |||
13 | /** |
||
14 | * The console command signature. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $signature = 'addon:list'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'List up addon information'; |
||
26 | |||
27 | /** |
||
28 | * Execute the console command. |
||
29 | * |
||
30 | * @return mixed |
||
31 | */ |
||
32 | 1 | public function handle(Filesystem $filesystem, AddonEnvironment $env) |
|
33 | { |
||
34 | // make addons/ |
||
35 | 1 | $addonsDirectory = $env->path(); |
|
36 | 1 | if (!$filesystem->exists($addonsDirectory)) { |
|
37 | $filesystem->makeDirectory($addonsDirectory); |
||
38 | } |
||
39 | |||
40 | // copy app/config/addon.php |
||
41 | 1 | $addonConfigSourceFile = __DIR__.'/../../config/addon.php'; |
|
42 | 1 | $addonConfigFile = $this->laravel['path.config'].'/addon.php'; |
|
43 | 1 | if (!$filesystem->exists($addonConfigFile)) { |
|
44 | 1 | $filesystem->copy($addonConfigSourceFile, $addonConfigFile); |
|
45 | |||
46 | 1 | $this->info('make config: '.$addonConfigFile); |
|
47 | 1 | } |
|
48 | |||
49 | // show lists |
||
50 | 1 | $addons = $env->addons(); |
|
51 | 1 | foreach ($addons as $addon) { |
|
52 | 1 | $this->dump($addon); |
|
53 | 1 | } |
|
54 | 1 | } |
|
55 | |||
56 | 1 | protected function dump($addon) |
|
62 | } |
||
63 |