Class: Specinfra::Backend::Docker

Inherits:
Exec
  • Object
show all
Defined in:
lib/specinfra/backend/docker.rb

Instance Method Summary collapse

Methods inherited from Base

#set_example

Constructor Details

#initializeDocker



3
4
5
6
7
8
9
10
11
12
# File 'lib/specinfra/backend/docker.rb', line 3

def initialize
  begin
    require 'docker' unless defined?(::Docker)
  rescue LoadError
    fail "Docker client library is not available. Try installing `docker-api' gem."
  end

  @images = []
  ::Docker.url = Specinfra.configuration.docker_url
end

Instance Method Details

#add_pre_command(cmd) ⇒ Object



24
25
26
# File 'lib/specinfra/backend/docker.rb', line 24

def add_pre_command(cmd)
  cmd
end

#build_command(cmd) ⇒ Object



20
21
22
# File 'lib/specinfra/backend/docker.rb', line 20

def build_command(cmd)
  cmd
end

#run_command(cmd, opts = {}) ⇒ Object



14
15
16
17
18
# File 'lib/specinfra/backend/docker.rb', line 14

def run_command(cmd, opts={})
  cmd = build_command(cmd)
  cmd = add_pre_command(cmd)
  docker_run!(cmd)
end

#send_file(from, to) ⇒ Object



28
29
30
# File 'lib/specinfra/backend/docker.rb', line 28

def send_file(from, to)
  @images << current_image.insert_local('localPath' => from, 'outputPath' => to)
end