Class: Aruba::DockerRunCommandLineBuilder
- Inherits:
-
Object
- Object
- Aruba::DockerRunCommandLineBuilder
- Defined in:
- lib/aruba/tasks/docker_helpers.rb
Instance Method Summary collapse
-
#initialize(run_instance, opts = {}) ⇒ DockerRunCommandLineBuilder
constructor
A new instance of DockerRunCommandLineBuilder.
- #to_cli ⇒ Object
Constructor Details
#initialize(run_instance, opts = {}) ⇒ DockerRunCommandLineBuilder
Returns a new instance of DockerRunCommandLineBuilder.
73 74 75 76 |
# File 'lib/aruba/tasks/docker_helpers.rb', line 73 def initialize(run_instance, opts = {}) @run_instance = run_instance @opts = opts end |
Instance Method Details
#to_cli ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/aruba/tasks/docker_helpers.rb', line 78 def to_cli volumes = run_instance.volumes image = run_instance.image command = opts[:command] cmdline = [] cmdline << 'docker' cmdline << 'run' cmdline << '-it' cmdline << '--rm' cmdline << "--name #{run_instance.container_name}" volumes.each do |v| cmdline << "-v #{expand_volume_paths(v)}" end cmdline << image cmdline << command if command cmdline.join(' ') end |