1 | <?php |
||
14 | class CreateTicketDirTask implements Task |
||
15 | { |
||
16 | /** @var Ticket */ |
||
17 | private $ticket; |
||
18 | |||
19 | /** @var Parameters */ |
||
20 | private $applicationParams; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $path; |
||
24 | |||
25 | /** @var FileManagerService */ |
||
26 | private $fileManager; |
||
27 | |||
28 | 3 | public function __construct(Ticket $ticket, Parameters $applicationParams, FileManagerService $fileManager) |
|
35 | |||
36 | /** |
||
37 | * Creates directory for application, deploys it and installs symlinks. |
||
38 | * |
||
39 | * @throws FileNotFoundException |
||
40 | * @throws DirectoryNotFoundException |
||
41 | * @throws IOException |
||
42 | */ |
||
43 | 3 | public function execute() : bool |
|
51 | |||
52 | /** |
||
53 | * Creates directory for application |
||
54 | * |
||
55 | * @throws FileNotFoundException |
||
56 | */ |
||
57 | 3 | private function createDirectory() : bool |
|
68 | |||
69 | /** |
||
70 | * Runs git clone command in application directory. Returns true when process is finished. |
||
71 | * Uses SSH key for authorization. |
||
72 | * |
||
73 | * @throws DirectoryNotFoundException |
||
74 | */ |
||
75 | 2 | private function executeGitClone() : bool |
|
82 | |||
83 | /** |
||
84 | * Returns git clone bash command combined for particular application. |
||
85 | */ |
||
86 | 1 | private function combineCloneCommand() : string |
|
96 | |||
97 | /** |
||
98 | * Creates file with tickets current status and timestamp inside ticket dir. |
||
99 | */ |
||
100 | 1 | private function createSnapshot() : bool |
|
108 | |||
109 | /** |
||
110 | * Runs composer install command in ticket directory. |
||
111 | * Returns true when process is finished. |
||
112 | */ |
||
113 | 1 | private function executeComposerInstall() : bool |
|
119 | |||
120 | /** |
||
121 | * Installs symlinks for application. |
||
122 | */ |
||
123 | 1 | private function installSymlinks() : bool |
|
134 | } |
||
135 |