From 9da68bb1294b846bd0bfdbe49c131da42a5669e5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 13 Mar 2010 03:08:26 -0800 Subject: [PATCH] Expand paths properly for loading so that files already loaded aren't loaded twice --- lib/vagrant.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/vagrant.rb b/lib/vagrant.rb index a93685a6f..71332772d 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -4,12 +4,17 @@ PROJECT_ROOT = File.join(libdir, '..') unless defined?(PROJECT_ROOT) # The libs which must be loaded prior to the rest %w{tempfile open-uri json pathname logger uri net/http virtualbox net/ssh archive/tar/minitar - net/scp fileutils vagrant/util vagrant/actions/base vagrant/downloaders/base vagrant/actions/runner + net/scp fileutils}.each do |lib| + require lib +end + +# The vagrant specific files which must be loaded prior to the rest +%w{vagrant/util vagrant/actions/base vagrant/downloaders/base vagrant/actions/runner vagrant/config vagrant/provisioners/base vagrant/provisioners/chef}.each do |f| - require f + require File.expand_path(f, libdir) end # Glob require the rest -Dir[File.join(PROJECT_ROOT, "lib", "vagrant", "**", "*.rb")].each do |f| - require f +Dir[File.join(libdir, "vagrant", "**", "*.rb")].each do |f| + require File.expand_path(f, PROJECT_ROOT) end