Class: Flock::Sandbox::Runner
- Inherits:
-
Object
- Object
- Flock::Sandbox::Runner
- Defined in:
- lib/flock/sandbox.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #define(&blk) ⇒ Object
-
#initialize(args) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Runner
Returns a new instance of Runner.
17 18 19 |
# File 'lib/flock/sandbox.rb', line 17 def initialize(args) self.config_path, self.target = args end |
Instance Attribute Details
#config_path ⇒ Object
Returns the value of attribute config_path.
16 17 18 |
# File 'lib/flock/sandbox.rb', line 16 def config_path @config_path end |
#definition ⇒ Object
Returns the value of attribute definition.
16 17 18 |
# File 'lib/flock/sandbox.rb', line 16 def definition @definition end |
#target ⇒ Object
Returns the value of attribute target.
16 17 18 |
# File 'lib/flock/sandbox.rb', line 16 def target @target end |
Instance Method Details
#define(&blk) ⇒ Object
33 34 35 36 37 |
# File 'lib/flock/sandbox.rb', line 33 def define(&blk) self.definition = Definition.new context = Context.new(self, definition) context.instance_exec(definition, &blk) end |
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flock/sandbox.rb', line 21 def run instance_eval(File.open(config_path).read, config_path) case target when "docker" Docker.new(definition).run when "vagrant" Vagrant.new(definition).run when "docker-stop" DockerStop.new(definition).run end end |