1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Foundation\Generator\Commands; |
4
|
|
|
|
5
|
|
|
use Foundation\Generator\Abstracts\AbstractGeneratorCommand; |
6
|
|
|
use Foundation\Generator\Abstracts\FileGeneratorCommand; |
7
|
|
|
use Foundation\Generator\Events\ComposerGeneratedEvent; |
8
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
9
|
|
|
use Symfony\Component\Console\Input\InputOption; |
10
|
|
|
|
11
|
|
|
class ComposerMakeCommand extends FileGeneratorCommand |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* The console command name. |
15
|
|
|
* |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $name = 'larapi:make:composer'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* The console command description. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $description = 'Create a new composer file for the specified module'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The name of the generated resource. |
29
|
|
|
* |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $generatorName = 'composer'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The stub name. |
36
|
|
|
* |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $stub = 'composer.stub'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* The event that will fire when the file is created. |
43
|
|
|
* |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $event = ComposerGeneratedEvent::class; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* The file path. |
50
|
|
|
* |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
protected $filePath = ''; |
54
|
|
|
|
55
|
|
|
protected function stubOptions(): array |
56
|
|
|
{ |
57
|
|
|
return [ |
58
|
|
|
'LOWER_MODULE_NAME' => strtolower($this->getModuleName()), |
59
|
|
|
'AUTHOR_NAME' => $this->getAuthorName(), |
60
|
|
|
'AUTHOR_MAIL' => $this->getAuthorMail() |
61
|
|
|
]; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
protected function getAuthorName() :string { |
65
|
|
|
//TODO IMPLEMENT ASKING FOR AUTHOR NAME |
66
|
|
|
return 'arthur devious'; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
protected function getAuthorMail() :string { |
70
|
|
|
//TODO IMPLEMENT ASKING FOR AUTHOR MAIL |
71
|
|
|
return '[email protected]'; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
protected function getFileName() |
75
|
|
|
{ |
76
|
|
|
return 'composer.json'; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
} |
80
|
|
|
|