class VagrantPlugins::RsyncBack::RsyncBackCommand
Public Class Methods
synopsis()
click to toggle source
# File lib/vagrant-rsync-back/command/rsync_back.rb, line 117 def self.synopsis "syncs rsync synced folders from remote machine" end
Public Instance Methods
execute()
click to toggle source
# File lib/vagrant-rsync-back/command/rsync_back.rb, line 121 def execute opts = OptionParser.new do |o| o.banner = "Usage: vagrant rsync-back [vm-name]" o.separator "" end # Parse the options and return if we don't have any target. argv = parse_options(opts) return if !argv # Go through each machine and perform the rsync error = false with_target_vms(argv) do |machine| if !machine.communicate.ready? machine.ui.error(I18n.t("vagrant.rsync_communicator_not_ready")) error = true next end # Determine the rsync synced folders for this machine folders = synced_folders(machine)[:rsync] next if !folders || folders.empty? # Get the SSH info for this machine so we can access it ssh_info = machine.ssh_info # Sync them! folders.each do |id, folder_opts| VagrantPlugins::SyncedFolderRSync::RsyncHelper.rsync_single(machine, ssh_info, folder_opts, true) end end return error ? 1 : 0 end