Class: Devkitkat::Executor::Docker

Inherits:
Object
  • Object
show all
Defined in:
lib/devkitkat/executor/docker.rb

Constant Summary collapse

PreparationError =
Class.new(StandardError)
ROOT_IN_CONTAINER =
'/devkitkat'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ Docker

Returns a new instance of Docker.



15
16
17
# File 'lib/devkitkat/executor/docker.rb', line 15

def initialize(service)
  @service = service
end

Instance Attribute Details

#script_fileObject (readonly)

Returns the value of attribute script_file.



9
10
11
# File 'lib/devkitkat/executor/docker.rb', line 9

def script_file
  @script_file
end

#serviceObject (readonly)

Returns the value of attribute service.



9
10
11
# File 'lib/devkitkat/executor/docker.rb', line 9

def service
  @service
end

Instance Method Details

#cleanupObject



25
26
27
# File 'lib/devkitkat/executor/docker.rb', line 25

def cleanup
  stop_container
end

#commit(script_file) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/devkitkat/executor/docker.rb', line 29

def commit(script_file)
  @script_file = script_file

  rewrite_root_path!
  new_path = script_path_in_container

  exec([new_path], user: user_name)
end

#prepareObject



19
20
21
22
23
# File 'lib/devkitkat/executor/docker.rb', line 19

def prepare
  pull_image unless image_exist?
  start_container
  sync_user_with_host
end