Module: DockerCompose::Interactive
- Defined in:
- lib/capistrano/dockercompose/interactive.rb
Class Method Summary collapse
- .capture_local_or_remote(cmd) ⇒ Object
- .execute_local_or_remote_interactive(cmd) ⇒ Object
- .instance(file = '', project = '') ⇒ Object
- .local_stage? ⇒ Boolean
Class Method Details
.capture_local_or_remote(cmd) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/capistrano/dockercompose/interactive.rb', line 15 def self.capture_local_or_remote(cmd) puts "runnig: docker-compose #{cmd}" result = '' if local_stage? run_locally do result = capture "docker-compose #{cmd}" end else on roles fetch(:docker_compose_interactive_roles) do |_host| within current_path do result = capture "cd #{current_path} && docker-compose #{cmd}" end end end result end |
.execute_local_or_remote_interactive(cmd) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/capistrano/dockercompose/interactive.rb', line 32 def self.execute_local_or_remote_interactive(cmd) puts "runnig: docker-compose #{cmd}" if local_stage? system "docker-compose #{cmd}" else on roles fetch(:docker_compose_interactive_roles) do |host| run_interactively host do within current_path do execute "cd #{current_path} && docker-compose #{cmd}" end end end end end |
.instance(file = '', project = '') ⇒ Object
7 8 9 |
# File 'lib/capistrano/dockercompose/interactive.rb', line 7 def self.instance(file='', project='') Instance.new(file, project) end |
.local_stage? ⇒ Boolean
11 12 13 |
# File 'lib/capistrano/dockercompose/interactive.rb', line 11 def self.local_stage? fetch(:local_stage_name, 'local').to_sym == fetch(:stage).to_sym end |