|
38 | 38 | puts " Latest assets version: (#{assets_version})"
|
39 | 39 |
|
40 | 40 | file_path = "#{latest_release}/#{app_config_path}/assets_version.yml"
|
41 |
| - file_content = "parameters:\\n assets_version: #{assets_version}" |
| 41 | + file_content = "parameters:\n assets_version: #{assets_version}" |
42 | 42 | run "echo '#{file_content}' | #{try_sudo} tee #{file_path}"
|
43 | 43 | capifony_puts_ok
|
44 | 44 | end
|
|
192 | 192 | capifony_puts_ok
|
193 | 193 | else
|
194 | 194 | capifony_pretty_print "--> Installing Composer dependencies"
|
195 |
| - |
| 195 | + |
196 | 196 | command = "#{try_sudo} sh -c 'cd #{latest_release} && SYMFONY_ENV=#{symfony_env_prod} #{composer_bin} install #{options}'"
|
197 |
| - |
| 197 | + |
198 | 198 | if interactive_mode
|
199 |
| - |
| 199 | + |
200 | 200 | input = ''
|
201 | 201 | print_wizard = false
|
202 | 202 | close_header = true
|
203 | 203 | run(command, { :pty => true, :eof => false }) do |channel, stream, data|
|
204 |
| - |
| 204 | + |
205 | 205 | # on normal output
|
206 | 206 | channel.on_data do |ch, data|
|
207 |
| - |
| 207 | + |
208 | 208 | # check if composer is waiting for user input
|
209 | 209 | print_wizard = data =~ /:[[:space:]]*$/
|
210 |
| - |
| 210 | + |
211 | 211 | # avoid echoing the user input
|
212 | 212 | if input.strip != data.strip and not print_wizard
|
213 | 213 | logger.debug data
|
214 | 214 | end
|
215 |
| - |
| 215 | + |
216 | 216 | # if input has been requested
|
217 | 217 | if print_wizard
|
218 |
| - |
| 218 | + |
219 | 219 | if close_header
|
220 |
| - |
| 220 | + |
221 | 221 | # finalize the info string
|
222 | 222 | capifony_puts_ok
|
223 |
| - |
| 223 | + |
224 | 224 | # and open a new section
|
225 | 225 | capifony_pretty_print "--> Updating parameters"
|
226 | 226 | puts if logger.level == Logger::IMPORTANT
|
227 |
| - |
| 227 | + |
228 | 228 | close_header = false
|
229 | 229 | end
|
230 |
| - |
| 230 | + |
231 | 231 | print data
|
232 |
| - |
| 232 | + |
233 | 233 | # capture the user input
|
234 | 234 | input = $stdin.gets
|
235 |
| - |
| 235 | + |
236 | 236 | # send it to the remote process
|
237 | 237 | channel.send_data(input)
|
238 | 238 | end
|
239 | 239 | end
|
240 |
| - |
| 240 | + |
241 | 241 | # on error
|
242 | 242 | channel.on_extended_data do |ch, data|
|
243 | 243 | warn "[err :: #{ch[:server]}] #{data}"
|
244 | 244 | end
|
245 | 245 | end
|
246 |
| - |
| 246 | + |
247 | 247 | capifony_pretty_print "--> Parameters updated" if not close_header
|
248 |
| - |
| 248 | + |
249 | 249 | else
|
250 | 250 | run command
|
251 | 251 | end
|
252 |
| - |
| 252 | + |
253 | 253 | capifony_puts_ok
|
254 | 254 | end
|
255 | 255 | end
|
|
267 | 267 | end
|
268 | 268 |
|
269 | 269 | capifony_pretty_print "--> Updating Composer dependencies"
|
270 |
| - |
| 270 | + |
271 | 271 | command = "#{try_sudo} sh -c 'cd #{latest_release} && SYMFONY_ENV=#{symfony_env_prod} #{composer_bin} update #{options}'"
|
272 |
| - |
| 272 | + |
273 | 273 | if interactive_mode
|
274 |
| - |
| 274 | + |
275 | 275 | input = ''
|
276 | 276 | print_wizard = false
|
277 | 277 | close_header = true
|
278 | 278 | run(command, { :pty => true, :eof => false }) do |channel, stream, data|
|
279 |
| - |
| 279 | + |
280 | 280 | # on normal output
|
281 | 281 | channel.on_data do |ch, data|
|
282 |
| - |
| 282 | + |
283 | 283 | # check if composer is waiting for user input
|
284 | 284 | print_wizard = data =~ /:[[:space:]]*$/
|
285 |
| - |
| 285 | + |
286 | 286 | # avoid echoing the user input
|
287 | 287 | if input.strip != data.strip and not print_wizard
|
288 | 288 | logger.debug data
|
289 | 289 | end
|
290 |
| - |
| 290 | + |
291 | 291 | # if input has been requested
|
292 | 292 | if print_wizard
|
293 |
| - |
| 293 | + |
294 | 294 | if close_header
|
295 |
| - |
| 295 | + |
296 | 296 | # finalize the info string
|
297 | 297 | capifony_puts_ok
|
298 |
| - |
| 298 | + |
299 | 299 | # and open a new section
|
300 | 300 | capifony_pretty_print "--> Updating parameters"
|
301 | 301 | puts if logger.level == Logger::IMPORTANT
|
302 |
| - |
| 302 | + |
303 | 303 | close_header = false
|
304 | 304 | end
|
305 |
| - |
| 305 | + |
306 | 306 | print data
|
307 |
| - |
| 307 | + |
308 | 308 | # capture the user input
|
309 | 309 | input = $stdin.gets
|
310 |
| - |
| 310 | + |
311 | 311 | # send it to the remote process
|
312 | 312 | channel.send_data(input)
|
313 | 313 | end
|
314 | 314 | end
|
315 |
| - |
| 315 | + |
316 | 316 | # on error
|
317 | 317 | channel.on_extended_data do |ch, data|
|
318 | 318 | warn "[err :: #{ch[:server]}] #{data}"
|
319 | 319 | end
|
320 | 320 | end
|
321 |
| - |
| 321 | + |
322 | 322 | capifony_pretty_print "--> Parameters updated" if not close_header
|
323 |
| - |
| 323 | + |
324 | 324 | else
|
325 | 325 | run command
|
326 | 326 | end
|
327 |
| - |
| 327 | + |
328 | 328 | capifony_puts_ok
|
329 | 329 | end
|
330 | 330 |
|
|
0 commit comments