Class: SpecInfra::Backend::Docker
- Defined in:
- lib/specinfra/backend/docker.rb
Instance Method Summary collapse
- #add_pre_command(cmd) ⇒ Object
- #build_command(cmd) ⇒ Object
- #copy_file(from, to) ⇒ Object
-
#initialize ⇒ Docker
constructor
A new instance of Docker.
- #run_command(cmd, opts = {}) ⇒ Object
Methods inherited from Exec
#check_executable, #check_monitored_by_monit, #check_mounted, #check_os, #check_readable, #check_routing_table, #check_running, #check_writable, #run_with_no_ruby_environment
Methods inherited from Base
#check_zero, #commands, #method_missing, #set_commands, #set_example
Constructor Details
#initialize ⇒ Docker
Returns a new instance of Docker.
4 5 6 |
# File 'lib/specinfra/backend/docker.rb', line 4 def initialize @images = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SpecInfra::Backend::Base
Instance Method Details
#add_pre_command(cmd) ⇒ Object
18 19 20 |
# File 'lib/specinfra/backend/docker.rb', line 18 def add_pre_command(cmd) cmd end |
#build_command(cmd) ⇒ Object
14 15 16 |
# File 'lib/specinfra/backend/docker.rb', line 14 def build_command(cmd) cmd end |
#copy_file(from, to) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/specinfra/backend/docker.rb', line 22 def copy_file(from, to) begin @images << current_image.insert_local('localPath' => from, 'outputPath' => to) rescue ::Docker::Error::DockerError return false end true end |
#run_command(cmd, opts = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/specinfra/backend/docker.rb', line 8 def run_command(cmd, opts={}) cmd = build_command(cmd) cmd = add_pre_command(cmd) docker_run!(cmd) end |