Class: VagrantConductor

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/conductor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ VagrantConductor

Returns a new instance of VagrantConductor.



14
15
16
# File 'lib/vagrant/conductor.rb', line 14

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



12
13
14
# File 'lib/vagrant/conductor.rb', line 12

def config
  @config
end

Instance Method Details

#configure_environment(args) ⇒ Object



24
25
26
27
# File 'lib/vagrant/conductor.rb', line 24

def configure_environment(args)
  config = VagrantPlugins::Conductor::Configure.new(@config)
  config.configure(args)
end

#init(config, default = nil) ⇒ Object



18
19
20
21
22
# File 'lib/vagrant/conductor.rb', line 18

def init(config, default = nil)
  args = merge_args(config, default)
  configure_environment(args)
  provision_modules(args)
end

#load(path) ⇒ Object

Load and read a YAML file



44
45
46
# File 'lib/vagrant/conductor.rb', line 44

def load(path)
  YAML::load(File.read(path))
end

#merge_args(config, default = nil) ⇒ Object

Merge arguments from the default config



35
36
37
38
39
40
41
# File 'lib/vagrant/conductor.rb', line 35

def merge_args(config, default = nil)
  args = load(config)
  if !default.nil? && File.exist?(default)
    args.deep_merge(load(default))
  end
  args
end

#provision_modules(args) ⇒ Object



29
30
31
32
# File 'lib/vagrant/conductor.rb', line 29

def provision_modules(args)
  modules = VagrantPlugins::Conductor::Provisioner.new(@config)
  modules.provision(args)
end