Class: VagrantReflect::Util::Sync
- Inherits:
-
Object
- Object
- VagrantReflect::Util::Sync
- Defined in:
- lib/vagrant-reflect/util/sync.rb
Overview
This is a helper that abstracts out the functionality of rsync and rm
Instance Method Summary collapse
-
#initialize(machine, opts) ⇒ Sync
constructor
A new instance of Sync.
- #sync_full ⇒ Object
- #sync_incremental(items, &block) ⇒ Object
- #sync_removals(items, &block) ⇒ Object
- #sync_removals_parents(guest_items) ⇒ Object
Constructor Details
#initialize(machine, opts) ⇒ Sync
Returns a new instance of Sync.
10 11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-reflect/util/sync.rb', line 10 def initialize(machine, opts) @machine = machine init_paths(opts) @shell = Shell.new(@machine, @guestpath, @hostpath, opts[:exclude]) log_configuration opts[:exclude] || [] end |
Instance Method Details
#sync_full ⇒ Object
24 25 26 27 |
# File 'lib/vagrant-reflect/util/sync.rb', line 24 def sync_full r = Vagrant::Util::SubprocessPatched.execute(*@shell.rsync_command_full) check_exit @shell.rsync_command_full, r end |
#sync_incremental(items, &block) ⇒ Object
20 21 22 |
# File 'lib/vagrant-reflect/util/sync.rb', line 20 def sync_incremental(items, &block) send_items_to_command items, @shell.rsync_command_inc, &block end |
#sync_removals(items, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/vagrant-reflect/util/sync.rb', line 29 def sync_removals(items, &block) # Look for removed directories and fill in guest paths dirs = prepare_items_for_removal(items) send_items_to_command items, @shell.rm_command, &block sync_removals_parents dirs.values unless dirs.empty? end |
#sync_removals_parents(guest_items) ⇒ Object
37 38 39 |
# File 'lib/vagrant-reflect/util/sync.rb', line 37 def sync_removals_parents(guest_items) send_items_to_command guest_items, @shell.rmdir_command end |