Module: Vgrnt::Util::Vagrantfile::Vagrant

Defined in:
lib/vgrnt/util/vagrantfile.rb

Class Method Summary collapse

Class Method Details

._eval_vagrantfile(path = nil) ⇒ Object

eval Vagrantfile inside of Vgrnt::Util::Vagrantfile namespace



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vgrnt/util/vagrantfile.rb', line 16

def self._eval_vagrantfile(path = nil)
  # NOT THREAD SAFE (not sure how to do this given static methods)
  @@vagrant_config_vms = []

  vgrntfile_source = File.read(path || './Vagrantfile')
  if RUBY_VERSION.to_f <= 1.8
    vgrntfile_source = Vagrant::_remove_named_arguments(vgrntfile_source)
  end
  module_eval(vgrntfile_source)

  @@vagrant_config_vms << :default if @@vagrant_config_vms.empty?
  return @@vagrant_config_vms
end

._remove_named_arguments(source) ⇒ Object



10
11
12
13
# File 'lib/vgrnt/util/vagrantfile.rb', line 10

def self._remove_named_arguments(source)
  source = source.gsub(/([\s\(,])[a-zA-Z0-9_]+: ?/, '\1')
  return source
end

.configure(*args) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



30
31
32
# File 'lib/vgrnt/util/vagrantfile.rb', line 30

def self.configure(*args, &block)
  yield self
end

.define(*args) ⇒ Object



34
35
36
# File 'lib/vgrnt/util/vagrantfile.rb', line 34

def self.define(*args)
  @@vagrant_config_vms << args.first
end

.method_missing(*args) ⇒ Object

stub out anything else



39
40
41
# File 'lib/vgrnt/util/vagrantfile.rb', line 39

def self.method_missing(*args)
  return self
end