No more `config.vm.project_directory`. The "v-root" shared folder is now a regular shraed folder like everything else.

This commit is contained in:
Mitchell Hashimoto 2010-06-03 22:19:42 -07:00
parent abef4d29ce
commit 7b6523371c
9 changed files with 14 additions and 31 deletions

View File

@ -5,7 +5,6 @@ Vagrant::Config.run do |config|
config.vagrant.home = "~/.vagrant"
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.host = "localhost"
config.ssh.port = 22
config.ssh.forwarded_port_key = "ssh"
@ -16,8 +15,6 @@ Vagrant::Config.run do |config|
config.vm.auto_port_range = (2200..2250)
config.vm.box_ovf = "box.ovf"
config.vm.base_mac = "0800279C2E42"
config.vm.project_directory = "/vagrant"
config.vm.rsync_project_directory = false
config.vm.forward_port("ssh", 22, 2222, :auto => true)
config.vm.disk_image_format = 'VMDK'
config.vm.provisioner = nil
@ -26,6 +23,10 @@ Vagrant::Config.run do |config|
config.vm.boot_mode = "vrdp"
config.vm.system = :linux
# Share the root folder. This can then be overridden by
# other Vagrantfiles, if they wish.
config.vm.share_folder("v-root", "/vagrant", ".")
# TODO new config class
config.vm.rsync_opts = "-ur --delete"
config.vm.rsync_script = "/tmp/rsync"

View File

@ -2,13 +2,6 @@ module Vagrant
module Actions
module VM
class Boot < Base
def prepare
@runner.env.config.vm.share_folder("v-root",
@runner.env.config.vm.project_directory,
@runner.env.root_path,
:rsync => @runner.env.config.vm.rsync_project_directory)
end
def execute!
@runner.invoke_around_callback(:boot) do
# Startup the VM

View File

@ -5,7 +5,7 @@ module Vagrant
def shared_folders
@runner.env.config.vm.shared_folders.inject([]) do |acc, data|
name, value = data
acc << [name, File.expand_path(value[:hostpath]), value[:guestpath], value[:rsyncpath]].compact
acc << [name, File.expand_path(value[:hostpath], @runner.env.root_path), value[:guestpath], value[:rsyncpath]].compact
end
end

View File

@ -61,7 +61,6 @@ module Vagrant
class SSHConfig < Base
attr_accessor :username
attr_accessor :password
attr_accessor :host
attr_accessor :port
attr_accessor :forwarded_port_key
@ -69,6 +68,10 @@ module Vagrant
attr_accessor :timeout
attr_accessor :private_key_path
# The attribute(s) below do nothing. They are just kept here to
# prevent syntax errors for backwards compat.
attr_accessor :password
def private_key_path
File.expand_path(@private_key_path, env.root_path)
end
@ -82,8 +85,6 @@ module Vagrant
attr_accessor :box_ovf
attr_accessor :base_mac
attr_accessor :boot_mode
attr_accessor :project_directory
attr_accessor :rsync_project_directory
attr_accessor :rsync_opts
attr_accessor :rsync_script
attr_accessor :rsync_crontab_entry_file

View File

@ -106,7 +106,7 @@ module Vagrant
# Set up initial configuration
data = {
:config => env.config,
:directory => env.config.vm.project_directory,
:directory => env.config.vm.shared_folders["v-root"][:guestpath],
}
# And wrap it under the "vagrant" namespace

View File

@ -27,7 +27,6 @@ class Test::Unit::TestCase
config.vagrant.log_output = nil
config.ssh.username = "foo"
config.ssh.password = "bar"
config.ssh.host = "baz"
config.ssh.port = 22
config.ssh.forwarded_port_key = "ssh"
@ -38,8 +37,6 @@ class Test::Unit::TestCase
config.vm.box = "foo"
config.vm.box_ovf = "box.ovf"
config.vm.base_mac = "42"
config.vm.project_directory = "/vagrant"
config.vm.rsync_project_directory = false
config.vm.disk_image_format = 'VMDK'
config.vm.forward_port("ssh", 22, 2222)
config.vm.shared_folder_uid = nil
@ -47,6 +44,7 @@ class Test::Unit::TestCase
config.vm.system = :linux
config.vm.rsync_script = "/foo"
config.vm.rsync_crontab_entry_file = "/tmp/foo"
config.vm.share_folder("v-root", "/vagrant", ".")
config.package.name = 'vagrant'
config.package.extension = '.box'

View File

@ -6,16 +6,6 @@ class BootActionTest < Test::Unit::TestCase
@runner.stubs(:invoke_callback)
end
context "preparing" do
should "add the root shared folder" do
@runner.env.config.vm.expects(:share_folder).with("v-root",
@runner.env.config.vm.project_directory,
@runner.env.root_path,
:rsync => @runner.env.config.vm.rsync_project_directory).once
@action.prepare
end
end
context "execution" do
should "invoke the 'boot' around callback" do
boot_seq = sequence("boot_seq")

View File

@ -34,7 +34,7 @@ class SharedFoldersActionTest < Test::Unit::TestCase
end
should "expand the path of the host folder" do
File.expects(:expand_path).with("baz").once.returns("expanded_baz")
File.expects(:expand_path).with("baz", @runner.env.root_path).once.returns("expanded_baz")
env = mock_environment do |config|
config.vm.shared_folders.clear

View File

@ -155,13 +155,13 @@ class ChefProvisionerTest < Test::Unit::TestCase
should "add the directory as a special case to the JSON" do
assert_json do |data|
assert_equal @env.config.vm.project_directory, data["vagrant"]["directory"]
assert_equal @env.config.vm.shared_folders["v-root"][:guestpath], data["vagrant"]["directory"]
end
end
should "add the config to the JSON" do
assert_json do |data|
assert_equal @env.config.vm.project_directory, data["vagrant"]["config"]["vm"]["project_directory"]
assert_equal @env.config.ssh.username, data["vagrant"]["config"]["ssh"]["username"]
end
end