Class: Vagrant::Config::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-node/obmanager.rb

Instance Method Summary collapse

Instance Method Details

#procs_for_path(path) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/vagrant-node/obmanager.rb', line 15

def procs_for_path(path)
	
	return Config.capture_configures do
		begin
			
			#Module hack to remove previous constans definitions
			modaux=Module.new
			res=modaux.module_eval(File.read(path))
			obconstants = Object.constants
			modaux.constants.each do |var|
				Object.send(:remove_const,var) if Object.constants.include?(var)
			end
			############################33
			
			
			Kernel.load path
		rescue SyntaxError => e
			# Report syntax errors in a nice way.
			raise Errors::VagrantfileSyntaxError, :file => e.message
		rescue SystemExit
			# Continue raising that exception...
			raise
		rescue Vagrant::Errors::VagrantError
			# Continue raising known Vagrant errors since they already
			# contain well worded error messages and context.
			raise
		rescue Exception => e
			@logger.error("Vagrantfile load error: #{e.message}")
			@logger.error(e.backtrace.join("\n"))

		# Report the generic exception
		raise Errors::VagrantfileLoadError,
		  :path => path,
		  :message => e.message
		end
      	end
end