Fixes to unison. Now tested and working.

This commit is contained in:
Mitchell Hashimoto 2010-06-20 14:14:11 -07:00
parent e751d3e21a
commit e8fd57fbbb
4 changed files with 20 additions and 5 deletions

View File

@ -8,6 +8,9 @@ module Vagrant
runner.env.config.vm.shared_folders.inject({}) do |acc, data|
key, value = data
# This to prevent overwriting the actual shared folders data
value = value.dup
if value[:sync]
# Syncing this folder. Change the guestpath to reflect
# what we're actually mounting.

View File

@ -45,7 +45,7 @@ echo $$ > "${LOCK_FILE}"
while [ 1 ]; do
echo 'Syncing...'
# TODO check result and output log data... somewhere!
unison $1 $2 $3
sudo unison $1 $2 $3 > unison.log 2>&1
sleep 1
done

View File

@ -81,6 +81,17 @@ class SharedFoldersActionTest < Test::Unit::TestCase
assert_equal "#{guest}#{@runner.env.config.unison.folder_suffix}", result[name][:guestpath]
assert_equal guest, result[name][:original][:guestpath]
end
should "not destroy original hash" do
@folders = stub_shared_folders do |config|
config.vm.share_folder("foo", "bar", "baz", :sync => true)
end
folder = @folders["foo"].dup
@action.shared_folders
assert_equal folder, @runner.env.config.vm.shared_folders["foo"]
end
end
context "unison shared folders" do
@ -183,11 +194,12 @@ class SharedFoldersActionTest < Test::Unit::TestCase
should "prepare unison then create for each folder" do
seq = sequence("unison seq")
@runner.system.expects(:prepare_unison).with(@ssh).once.in_sequence(seq)
@folders.each do |name, data|
@action.unison_folders.each do |name, data|
if data[:sync]
@runner.system.expects(:create_unison).with do |ssh, opts|
assert_equal @ssh, ssh
assert_equal data, opts
true
end
end

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Mitchell Hashimoto", "John Bender"]
s.date = %q{2010-06-17}
s.date = %q{2010-06-20}
s.default_executable = %q{vagrant}
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
@ -106,12 +106,12 @@ Gem::Specification.new do |s|
"templates/Vagrantfile.erb",
"templates/chef_server_client.erb",
"templates/chef_solo_solo.erb",
"templates/crontab_entry.erb",
"templates/network_entry.erb",
"templates/package_Vagrantfile.erb",
"templates/ssh_config.erb",
"templates/strings.yml",
"templates/sync.erb",
"templates/unison/crontab_entry.erb",
"templates/unison/script.erb",
"test/test_helper.rb",
"test/vagrant/actions/base_test.rb",
"test/vagrant/actions/box/add_test.rb",