lib/vagrant/environment.rb in vagrant-1.0.0 vs lib/vagrant/environment.rb in vagrant-1.0.1

- old
+ new

@@ -1,9 +1,10 @@ require 'pathname' require 'fileutils' require 'log4r' +require 'rubygems' # This is needed for plugin loading below. require 'vagrant/util/file_mode' require 'vagrant/util/platform' module Vagrant @@ -53,16 +54,19 @@ :ui_class => nil, :home_path => nil }.merge(opts || {}) # Set the default working directory to look for the vagrantfile + opts[:cwd] ||= ENV["VAGRANT_CWD"] if ENV.has_key?("VAGRANT_CWD") opts[:cwd] ||= Dir.pwd opts[:cwd] = Pathname.new(opts[:cwd]) + raise Errors::EnvironmentNonExistentCWD if !opts[:cwd].directory? - # Set the default vagrantfile name, which can be either Vagrantfile - # or vagrantfile (capital for backwards compatibility) - opts[:vagrantfile_name] ||= ["Vagrantfile", "vagrantfile"] + # Set the Vagrantfile name up. We append "Vagrantfile" and "vagrantfile" so that + # those continue to work as well, but anything custom will take precedence. + opts[:vagrantfile_name] ||= [] opts[:vagrantfile_name] = [opts[:vagrantfile_name]] if !opts[:vagrantfile_name].is_a?(Array) + opts[:vagrantfile_name] += ["Vagrantfile", "vagrantfile"] # Set instance variables for all the configuration parameters. @cwd = opts[:cwd] @vagrantfile_name = opts[:vagrantfile_name] @lock_path = opts[:lock_path]