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() : void |
|
51 | |||
52 | /** |
||
53 | * Creates directory for application |
||
54 | * |
||
55 | * @throws FileNotFoundException |
||
56 | */ |
||
57 | 3 | private function createDirectory() : void |
|
66 | |||
67 | /** |
||
68 | * Runs git clone command in application directory. Returns true when process is finished. |
||
69 | * Uses SSH key for authorization. |
||
70 | * |
||
71 | * @throws DirectoryNotFoundException |
||
72 | */ |
||
73 | 2 | private function executeGitClone() : void |
|
78 | |||
79 | /** |
||
80 | * Returns git clone bash command combined for particular application. |
||
81 | */ |
||
82 | 1 | private function combineCloneCommand() : string |
|
92 | |||
93 | /** |
||
94 | * Creates file with tickets current status and timestamp inside ticket dir. |
||
95 | */ |
||
96 | 1 | private function createSnapshot() : void |
|
102 | |||
103 | /** |
||
104 | * Runs composer install command in ticket directory. |
||
105 | * Returns true when process is finished. |
||
106 | */ |
||
107 | 1 | private function executeComposerInstall() : bool |
|
113 | |||
114 | /** |
||
115 | * Installs symlinks for application. |
||
116 | * |
||
117 | * @throws IOException |
||
118 | */ |
||
119 | 1 | private function installSymlinks() : bool |
|
130 | } |
||
131 |