Module: VagrantPlugins::Unison::UnisonSync

Included in:
Command, CommandCleanup, CommandInteract, CommandRepeat
Defined in:
lib/vagrant-unison-morroni/unison_sync.rb

Instance Method Summary collapse

Instance Method Details

#execute_sync_command(machine) {|shell_command| ... } ⇒ Object

Yields:

  • (shell_command)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant-unison-morroni/unison_sync.rb', line 4

def execute_sync_command(machine)
  unison_paths = UnisonPaths.new(@env, machine)
  guest_path = unison_paths.guest
  host_path = unison_paths.host

  @env.ui.info "Unisoning changes from {host}::#{host_path} --> {guest VM}::#{guest_path}"

  # Create the guest path
  machine.communicate.sudo("mkdir -p '#{guest_path}'")
  machine.communicate.sudo("chown #{machine.ssh_info[:username]} '#{guest_path}'")

  ssh_command = SshCommand.new(machine, unison_paths)
  shell_command = ShellCommand.new(machine, unison_paths, ssh_command)

  yield shell_command
end