Allow dummy config to eval config blocks to set instance variables
This commit is contained in:
parent
9c1d09eb8a
commit
b152cc4f2b
@ -5,8 +5,18 @@ module Vagrant
|
||||
# to it. Anything, and it just appears to keep working.
|
||||
class DummyConfig
|
||||
def method_missing(name, *args, &block)
|
||||
# Trying to define a variable
|
||||
if name.to_s.match(/[\w]*=/)
|
||||
var_name = "@#{name.to_s.split("=")[0]}"
|
||||
self.instance_variable_set(var_name, args[0])
|
||||
else
|
||||
DummyConfig.new
|
||||
end
|
||||
end
|
||||
|
||||
def merge(c)
|
||||
c
|
||||
end
|
||||
|
||||
def set_options(options)
|
||||
options.each do |key, value|
|
||||
|
||||
@ -25,6 +25,7 @@ def stringify_symbols(m)
|
||||
end
|
||||
if v.is_a?(Array)
|
||||
v.map!{|sk| sk.is_a?(Symbol) ? sk.to_s : sk}
|
||||
stringify_symbols(v)
|
||||
next
|
||||
end
|
||||
k = k.to_s if k.is_a?(Symbol)
|
||||
@ -172,8 +173,6 @@ def parse_vagrantfile(path)
|
||||
extract_synced_folders(config_vm_proto.synced_folders, vm_config.synced_folders)
|
||||
extract_provider(config_vm_proto.providers, vm_config)
|
||||
|
||||
# require "pry-byebug"; binding.pry
|
||||
|
||||
machine_configs << Hashicorp::Vagrant::VagrantfileComponents::MachineConfig.new(
|
||||
name: mach.to_s,
|
||||
config_vm: config_vm_proto,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user