Merge pull request #5282 from Scythril/windows_rsync_pre

guests/windows: windows rsync needs to create folders before syncing
This commit is contained in:
Mitchell Hashimoto 2015-02-24 09:49:57 -08:00
commit 8e76ff64d2
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,13 @@
module VagrantPlugins
module GuestWindows
module Cap
class RSync
def self.rsync_pre(machine, opts)
machine.communicate.tap do |comm|
comm.execute("mkdir '#{opts[:guestpath]}'")
end
end
end
end
end
end

View File

@ -64,6 +64,11 @@ module VagrantPlugins
Cap::MountSharedFolder
end
guest_capability(:windows, :rsync_pre) do
require_relative "cap/rsync"
Cap::RSync
end
protected
def self.init!

View File

@ -0,0 +1,26 @@
require File.expand_path("../../../../../base", __FILE__)
require Vagrant.source_root.join("plugins/guests/windows/cap/rsync")
describe "VagrantPlugins::GuestWindows::Cap::RSync" do
let(:described_class) do
VagrantPlugins::GuestWindows::Plugin.components.guest_capabilities[:windows].get(:rsync_pre)
end
let(:machine) { double("machine") }
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
before do
allow(machine).to receive(:communicate).and_return(communicator)
end
after do
communicator.verify_expectations!
end
describe ".rsync_pre" do
it 'makes the guestpath directory with mkdir' do
communicator.expect_command("mkdir '/sync_dir'")
described_class.rsync_pre(machine, guestpath: '/sync_dir')
end
end
end