Sha256: ccf75c63745c5a6a3600a0e76251c47043ca394e71dbf750aecffae1169fab87
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require_relative '../errors' module VagrantPlugins module Rsync module Cap class EnsureRsync def self.ensure_rsync(machine, env) return unless machine.communicate.ready? if rsync_installed?(machine) env.ui.info I18n.t('vagrant_rsync.rsync_installed') else env.ui.info I18n.t('vagrant_rsync.installing_rsync') install_rsync!(machine) end end def self.rsync_installed?(machine) machine.communicate.execute("rsync --version") rescue false end def self.install_rsync!(machine) machine.communicate.tap do |comm| case machine.guest.name when :debian, :ubuntu comm.sudo "apt-get update" comm.sudo "apt-get install rsync" when :fedora, :centos, :redhat comm.sudo "yum install rsync" when :suse comm.sudo "yast2 -i rsync" when :gentoo comm.sudo "emerge rsync" when :arch comm.sudo "pacman -s rsync" else raise Errors::RsyncNotAvailableError, guest: machine.guest.name end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-rsync-0.2.3 | lib/vagrant-rsync/cap/ensure_rsync.rb |
vagrant-rsync-0.2.2 | lib/vagrant-rsync/cap/ensure_rsync.rb |
vagrant-rsync-0.2.1 | lib/vagrant-rsync/cap/ensure_rsync.rb |