6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/vagrant-rsync/command.rb', line 6
def execute
options = {}
options[:install_rsync] = true
options[:verbose] = false
opts = OptionParser.new do |o|
o.banner = "DEPRECATED!! Usage: vagrant rsync [vm-name]"
o.on("-n", "--no-install", "Do not attempt to install rysnc if not found") do |ni|
options[:install_rsync] = !ni
end
o.on('-v', '--verbose', "Run verbosely") do |v|
options[:verbose] = v
end
o.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
argv = parse_options(opts)
return if !argv
with_target_vms(argv) do |vm|
raise Vagrant::Errors::VMNotCreatedError if vm.state.id == :not_created
raise Vagrant::Errors::VMInaccessible if vm.state.id == :inaccessible
end
with_target_vms(argv) do |machine|
if options[:install_rsync]
@env.ui.info I18n.t('vagrant_rsync.ensure_rsync')
machine.guest.capability(:ensure_rsync, @env)
end
@env.ui.info I18n.t('vagrant_rsync.rsync_folders')
machine.guest.capability(:rsync_folders)
end
end
|