Class: Flock::Sandbox::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/flock/sandbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner, definition) ⇒ Context

Returns a new instance of Context.



54
55
56
57
# File 'lib/flock/sandbox.rb', line 54

def initialize(runner, definition)
  self.runner = runner
  self.definition = definition
end

Instance Attribute Details

#definitionObject

Returns the value of attribute definition.



53
54
55
# File 'lib/flock/sandbox.rb', line 53

def definition
  @definition
end

#runnerObject

Returns the value of attribute runner.



53
54
55
# File 'lib/flock/sandbox.rb', line 53

def runner
  @runner
end

Instance Method Details

#consul_key(key) ⇒ Object



66
67
68
# File 'lib/flock/sandbox.rb', line 66

def consul_key(key)
  open(definition.config[:consul] + "/v1/kv/" + key + "?raw").read
end

#host(container) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/flock/sandbox.rb', line 58

def host(container)
  case runner.target
  when "docker"
    container
  when "vagrant"
    definition.config[:private_network]
  end
end