Method: Vagrant::TestHelpers#vagrantfile
- Defined in:
- lib/vagrant/test_helpers.rb
#vagrantfile(*args) ⇒ Object
Creates a Vagrantfile with the given contents in the given app directory. If no app directory is specified, then a default Vagrant app is used.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vagrant/test_helpers.rb', line 25 def vagrantfile(*args) path = args.shift.join("Vagrantfile") if Pathname === args.first path ||= vagrant_app("Vagrantfile") # Create this box so that it exists vagrant_box("base") str = args.shift || "" File.open(path.to_s, "w") do |f| f.puts "ENV['VAGRANT_HOME'] = '#{home_path}'" f.puts "Vagrant::Config.run do |config|" f.puts "config.vm.base_mac = 'foo' if !config.vm.base_mac" f.puts "config.vm.box = 'base'" f.puts str f.puts "end" end path.parent end |