Sha256: 5a59c0e63488eb40dbcf93e85a5d3a4535ee3a39be7b8118df4cdad8bf2e17c4

Contents?: true

Size: 1.46 KB

Versions: 41

Compression:

Stored size: 1.46 KB

Contents

require "log4r"

require "vagrant/util/subprocess"
require "vagrant/util/which"

require_relative "helper"

module VagrantPlugins
  module SyncedFolderRSync
    class SyncedFolder < Vagrant.plugin("2", :synced_folder)
      include Vagrant::Util

      def initialize(*args)
        super

        @logger = Log4r::Logger.new("vagrant::synced_folders::rsync")
      end

      def usable?(machine, raise_error=false)
        rsync_path = Which.which("rsync")
        return true if rsync_path
        return false if !raise_error
        raise Vagrant::Errors::RSyncNotFound
      end

      def prepare(machine, folders, opts)
        # Nothing is necessary to do before VM boot.
      end

      def enable(machine, folders, opts)
        if machine.guest.capability?(:rsync_installed)
          installed = machine.guest.capability(:rsync_installed)
          if !installed
            can_install = machine.guest.capability?(:rsync_install)
            raise Vagrant::Errors::RSyncNotInstalledInGuest if !can_install
            machine.ui.info I18n.t("vagrant.rsync_installing")
            machine.guest.capability(:rsync_install)
          end
        end

        ssh_info = machine.ssh_info

        if ssh_info[:private_key_path].empty? && ssh_info[:password]
          machine.ui.warn(I18n.t("vagrant.rsync_ssh_password"))
        end

        folders.each do |id, folder_opts|
          RsyncHelper.rsync_single(machine, ssh_info, folder_opts)
        end
      end
    end
  end
end

Version data entries

41 entries across 34 versions & 7 rubygems

Version Path
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/synced_folders/rsync/synced_folder.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/synced_folders/rsync/synced_folder.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/synced_folders/rsync/synced_folder.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.9.5.1 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.9.1.1 plugins/synced_folders/rsync/synced_folder.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/synced_folders/rsync/synced_folder.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/synced_folders/rsync/synced_folder.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/synced_folders/rsync/synced_folder.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.5.2 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.5.1 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.4.2 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.4.1 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.1.2 plugins/synced_folders/rsync/synced_folder.rb
vagrant-unbundled-1.8.1.1 plugins/synced_folders/rsync/synced_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/synced_folders/rsync/synced_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/synced_folders/rsync/synced_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/synced_folders/rsync/synced_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/synced_folders/rsync/synced_folder.rb