|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PWWEB\Artomator\Commands\Publish; |
|
4
|
|
|
|
|
5
|
|
|
use InfyOm\Generator\Commands\Publish\PublishBaseCommand; |
|
6
|
|
|
|
|
7
|
|
|
class PublishTemplateCommand extends PublishBaseCommand |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* The console command name. |
|
11
|
|
|
* |
|
12
|
|
|
* @var string |
|
13
|
|
|
*/ |
|
14
|
|
|
protected $name = 'artomator.publish:templates'; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* The console command description. |
|
18
|
|
|
* |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $description = 'Publishes artomator generator templates.'; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Templates Directory. |
|
25
|
|
|
* |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
private $templatesDir; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Execute the command. |
|
32
|
|
|
* |
|
33
|
|
|
* @return void |
|
34
|
|
|
*/ |
|
35
|
|
|
public function handle() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->templatesDir = config( |
|
38
|
|
|
'infyom.laravel_generator.path.templates_dir', |
|
39
|
|
|
resource_path('infyom/infyom-generator-templates/') |
|
40
|
|
|
); |
|
41
|
|
|
|
|
42
|
|
|
if (true === $this->publishGeneratorTemplates()) { |
|
43
|
|
|
$this->publishScaffoldTemplates(); |
|
44
|
|
|
$this->publishSwaggerTemplates(); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Publishes templates. |
|
50
|
|
|
* |
|
51
|
|
|
* @return bool |
|
52
|
|
|
*/ |
|
53
|
|
|
public function publishGeneratorTemplates() |
|
54
|
|
|
{ |
|
55
|
|
|
$templatesPath = __DIR__.'/../../../../../infyomlabs/laravel-generator/templates'; |
|
56
|
|
|
|
|
57
|
|
|
$this->publishDirectory($templatesPath, $this->templatesDir, 'infyom-generator-templates'); |
|
58
|
|
|
|
|
59
|
|
|
$templatesPath = __DIR__.'/../../../templates'; |
|
60
|
|
|
|
|
61
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir, 'pwweb-artomator-templates'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Publishes scaffold stemplates. |
|
66
|
|
|
* |
|
67
|
|
|
* @return bool |
|
68
|
|
|
*/ |
|
69
|
|
|
public function publishScaffoldTemplates() |
|
70
|
|
|
{ |
|
71
|
|
|
$templateType = config('infyom.laravel_generator.templates', 'adminlte-templates'); |
|
72
|
|
|
|
|
73
|
|
|
$templatesPath = base_path('vendor/infyomlabs/'.$templateType.'/templates/scaffold'); |
|
74
|
|
|
|
|
75
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-templates/scaffold', true); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Publishes swagger stemplates. |
|
80
|
|
|
* |
|
81
|
|
|
* @return bool |
|
82
|
|
|
*/ |
|
83
|
|
|
public function publishSwaggerTemplates() |
|
84
|
|
|
{ |
|
85
|
|
|
$templatesPath = base_path('vendor/infyomlabs/swagger-generator/templates'); |
|
86
|
|
|
|
|
87
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir, 'swagger-generator', true); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Get the console command options. |
|
92
|
|
|
* |
|
93
|
|
|
* @return array |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getOptions() |
|
96
|
|
|
{ |
|
97
|
|
|
return []; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Get the console command arguments. |
|
102
|
|
|
* |
|
103
|
|
|
* @return array |
|
104
|
|
|
*/ |
|
105
|
|
|
protected function getArguments() |
|
106
|
|
|
{ |
|
107
|
|
|
return []; |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|