@@ 93-111 (lines=19) @@ | ||
90 | * |
|
91 | * @throws \Cog\Contracts\Paket\Job\Exceptions\JobFailed |
|
92 | */ |
|
93 | public function install(RequirementContract $requirement, JobContract $job): void |
|
94 | { |
|
95 | $flags = [ |
|
96 | '--no-interaction', |
|
97 | ]; |
|
98 | ||
99 | if ($requirement->isDevelopment()) { |
|
100 | $flags[] = '--dev'; |
|
101 | } |
|
102 | ||
103 | $command = sprintf( |
|
104 | '%s require %s %s', |
|
105 | '/usr/bin/composer', |
|
106 | $requirement, |
|
107 | implode(' ', $flags) |
|
108 | ); |
|
109 | ||
110 | $this->executeCommand($job, $command); |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * Uninstall Composer requirement. |
|
@@ 122-140 (lines=19) @@ | ||
119 | * |
|
120 | * @throws \Cog\Contracts\Paket\Job\Exceptions\JobFailed |
|
121 | */ |
|
122 | public function uninstall(RequirementContract $requirement, JobContract $job): void |
|
123 | { |
|
124 | $flags = [ |
|
125 | '--no-interaction', |
|
126 | ]; |
|
127 | ||
128 | if ($requirement->isDevelopment()) { |
|
129 | $flags[] = '--dev'; |
|
130 | } |
|
131 | ||
132 | $command = sprintf( |
|
133 | '%s remove %s %s', |
|
134 | '/usr/bin/composer', |
|
135 | $requirement->getName(), |
|
136 | implode(' ', $flags) |
|
137 | ); |
|
138 | ||
139 | $this->executeCommand($job, $command); |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Builds full command, executes it and logs process output. |