Class: Navy::CommandBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/navy/command_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container) ⇒ CommandBuilder

Returns a new instance of CommandBuilder.



6
7
8
9
# File 'lib/navy/command_builder.rb', line 6

def initialize(container)
  @container = container
  @spec = container.specification
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



4
5
6
# File 'lib/navy/command_builder.rb', line 4

def container
  @container
end

#specObject (readonly)

Returns the value of attribute spec.



4
5
6
# File 'lib/navy/command_builder.rb', line 4

def spec
  @spec
end

Instance Method Details

#build(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/navy/command_builder.rb', line 11

def build(options = {})
  cmd = []
  docker_run(cmd)
  docker_name(cmd)
  docker_links(cmd)
  docker_env(cmd)
  docker_volumes_from(cmd)
  docker_misc_args(cmd)

  docker_image(cmd)
  execute_command(cmd, options)
  cmd.compact
end