1 | <?php |
||
15 | class Builder extends Command |
||
16 | { |
||
17 | /** |
||
18 | * The directory that contains your application builds. |
||
19 | */ |
||
20 | const BUILD_PATH = BASE_PATH.DIRECTORY_SEPARATOR.'builds'; |
||
21 | |||
22 | /** |
||
23 | * Contains the default app structure. |
||
24 | * |
||
25 | * @var []string |
||
26 | */ |
||
27 | protected $structure = [ |
||
28 | 'app'.DIRECTORY_SEPARATOR, |
||
29 | 'bootstrap'.DIRECTORY_SEPARATOR, |
||
30 | 'vendor'.DIRECTORY_SEPARATOR, |
||
31 | 'config'.DIRECTORY_SEPARATOR, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | protected $signature = 'app:build {name=application : The build name}'; |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | protected $description = 'Perform an application build'; |
||
43 | |||
44 | /** |
||
45 | * Holds the configuration on is original state. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected static $config; |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function handle(): void |
||
67 | |||
68 | /** |
||
69 | * Builds the application. |
||
70 | * |
||
71 | * @param string $name |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | protected function build(string $name): Builder |
||
87 | |||
88 | /** |
||
89 | * Compiles the standalone application. |
||
90 | * |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return $this |
||
94 | */ |
||
95 | protected function compile(string $name): Builder |
||
119 | |||
120 | /** |
||
121 | * Gets a new instance of the compiler. |
||
122 | * |
||
123 | * @param string $name |
||
124 | * |
||
125 | * @return \Phar |
||
126 | */ |
||
127 | protected function getCompiler(string $name): \Phar |
||
140 | |||
141 | /** |
||
142 | * Creates the folder for the builds. |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | protected function makeFolder(): Builder |
||
154 | |||
155 | /** |
||
156 | * Moves the compiled files to the builds folder. |
||
157 | * |
||
158 | * @param string $name |
||
159 | * |
||
160 | * @return $this |
||
161 | */ |
||
162 | protected function cleanUp(string $name): Builder |
||
169 | |||
170 | /** |
||
171 | * Sets the executable mode on the standalone application file. |
||
172 | * |
||
173 | * @param string $name |
||
174 | * |
||
175 | * @return $this |
||
176 | */ |
||
177 | protected function setPermissions($name): Builder |
||
184 | |||
185 | /** |
||
186 | * Prepares the application for build. |
||
187 | * |
||
188 | * @return $this |
||
189 | */ |
||
190 | protected function prepare(): Builder |
||
204 | |||
205 | /** |
||
206 | * Prepares the application for build. |
||
207 | * |
||
208 | * @return $this |
||
209 | */ |
||
210 | protected function finish(): Builder |
||
218 | |||
219 | /** |
||
220 | * Makes sure that the finish is performed even |
||
221 | * if the command fails. |
||
222 | */ |
||
223 | public function __destruct() |
||
229 | } |
||
230 |