Class: DockerComposeDeploy::Actions::Hosts
- Inherits:
-
Struct
- Object
- Struct
- DockerComposeDeploy::Actions::Hosts
- Defined in:
- lib/docker_compose_deploy/actions/hosts.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
Instance Attribute Details
#shell ⇒ Object
Returns the value of attribute shell
3 4 5 |
# File 'lib/docker_compose_deploy/actions/hosts.rb', line 3 def shell @shell end |
Instance Method Details
#hijack ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/docker_compose_deploy/actions/hosts.rb', line 5 def hijack return unless DockerComposeDeploy.config.domains.any? shell.notify("Creating hosts entries for test_domains") host_entries = ["localhost", "vagrant"] + DockerComposeDeploy.config.domains Tempfile.open do |f| host_entries.each do |host| f.puts("127.0.0.1 #{host}") end f.close shell.scp!(f.path, "#{connection}:/tmp/hosts") shell.ssh!("sudo mv /tmp/hosts /etc/hosts") shell.notify("Wrote to /etc/hosts on test server:") shell.puts(`cat #{f.path}`) end end |