Allow dummy config to eval config blocks to set instance variables
This commit is contained in:
parent
9c1d09eb8a
commit
b152cc4f2b
@ -5,7 +5,17 @@ module Vagrant
|
|||||||
# to it. Anything, and it just appears to keep working.
|
# to it. Anything, and it just appears to keep working.
|
||||||
class DummyConfig
|
class DummyConfig
|
||||||
def method_missing(name, *args, &block)
|
def method_missing(name, *args, &block)
|
||||||
DummyConfig.new
|
# 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
|
end
|
||||||
|
|
||||||
def set_options(options)
|
def set_options(options)
|
||||||
|
|||||||
@ -25,6 +25,7 @@ def stringify_symbols(m)
|
|||||||
end
|
end
|
||||||
if v.is_a?(Array)
|
if v.is_a?(Array)
|
||||||
v.map!{|sk| sk.is_a?(Symbol) ? sk.to_s : sk}
|
v.map!{|sk| sk.is_a?(Symbol) ? sk.to_s : sk}
|
||||||
|
stringify_symbols(v)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
k = k.to_s if k.is_a?(Symbol)
|
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_synced_folders(config_vm_proto.synced_folders, vm_config.synced_folders)
|
||||||
extract_provider(config_vm_proto.providers, vm_config)
|
extract_provider(config_vm_proto.providers, vm_config)
|
||||||
|
|
||||||
# require "pry-byebug"; binding.pry
|
|
||||||
|
|
||||||
machine_configs << Hashicorp::Vagrant::VagrantfileComponents::MachineConfig.new(
|
machine_configs << Hashicorp::Vagrant::VagrantfileComponents::MachineConfig.new(
|
||||||
name: mach.to_s,
|
name: mach.to_s,
|
||||||
config_vm: config_vm_proto,
|
config_vm: config_vm_proto,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user