Class: RatDeployer::Cli
- Inherits:
-
Thor
- Object
- Thor
- RatDeployer::Cli
show all
- Includes:
- Command
- Defined in:
- lib/rat_deployer/cli.rb
Instance Method Summary
collapse
Methods included from Command
#ask_for_confirmation, #colorize_warning, #do_run, #put_error, #put_heading, #put_warning, #run
Instance Method Details
#compose(cmd, *cmd_flags, silent: false) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rat_deployer/cli.rb', line 35
def compose(cmd, *cmd_flags, silent: false)
env = RatDeployer::Config.env
project_name = RatDeployer::Config.all.fetch('project_name')
flags = [
"-f config/default.yml",
"-f config/#{env}.yml",
"-p #{project_name}_#{env}"
]
if RatDeployer::Config.remote
flags.unshift(RatDeployer::Config.remote_machine_flags)
end
cmd = run "docker-compose #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}", silent: silent
cmd.fetch(:output)
end
|
#deploy(*services) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rat_deployer/cli.rb', line 12
def deploy(*services)
RatDeployer::Notifier.notify_deploy_start
if services.any?
services_str = services.join(' ')
compose("pull #{services_str}")
compose("up -d --no-deps --force-recreate #{services_str}")
else
compose('pull')
compose('up -d')
end
RatDeployer::Notifier.notify_deploy_end
rescue Exception => e
RatDeployer::Notifier.notify <<-STR
Failed deploy on #{ENV.fetch('RAT_ENV')}"
Reason:
#{e.message}
STR
raise e
end
|
#docker(cmd, *cmd_flags) ⇒ Object