Even with a custom vagrantfile name, use defaults [GH-778]
This commit is contained in:
parent
bab5d7b685
commit
ce00a56ecb
|
@ -5,6 +5,8 @@
|
|||
possible load errors. [GH-781]
|
||||
- `vagrant destroy` shows a nice error when called without a
|
||||
TTY (and hence can't confirm). [GH-779]
|
||||
- Fix an issue with the `:vagrantfile_name` option to `Vagrant::Environment`
|
||||
not working properly. [GH-778]
|
||||
|
||||
## 1.0.0 (March 6, 2012)
|
||||
|
||||
|
|
|
@ -59,10 +59,11 @@ module Vagrant
|
|||
opts[:cwd] ||= Dir.pwd
|
||||
opts[:cwd] = Pathname.new(opts[:cwd])
|
||||
|
||||
# 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]
|
||||
|
|
|
@ -16,6 +16,14 @@ module Unit
|
|||
Vagrant::Environment.new(options)
|
||||
end
|
||||
|
||||
# This creates a file in the isolated environment. By default this file
|
||||
# will be created in the working directory of the isolated environment.
|
||||
def file(name, contents)
|
||||
@workdir.join(name).open("w+") do |f|
|
||||
f.write(contents)
|
||||
end
|
||||
end
|
||||
|
||||
def vagrantfile(contents, root=nil)
|
||||
root ||= @workdir
|
||||
root.join("Vagrantfile").open("w+") do |f|
|
||||
|
|
|
@ -120,6 +120,19 @@ VF
|
|||
env.config.global.vagrant.dotfile_name.should == "foo"
|
||||
end
|
||||
|
||||
it "should load from a custom Vagrantfile" do
|
||||
environment = isolated_environment do |env|
|
||||
env.file("non_standard_name", <<-VF)
|
||||
Vagrant::Config.run do |config|
|
||||
config.vagrant.dotfile_name = "custom"
|
||||
end
|
||||
VF
|
||||
end
|
||||
|
||||
env = environment.create_vagrant_env(:vagrantfile_name => "non_standard_name")
|
||||
env.config.global.vagrant.dotfile_name.should == "custom"
|
||||
end
|
||||
|
||||
it "should load VM configuration" do
|
||||
environment = isolated_environment do |env|
|
||||
env.vagrantfile(<<-VF)
|
||||
|
|
Loading…
Reference in New Issue