vagrant-syncer 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/example/Vagrantfile +9 -1
- data/lib/syncer/actions.rb +3 -4
- data/lib/syncer/command/rsync.rb +3 -2
- data/lib/syncer/command/rsync_auto.rb +9 -5
- data/lib/syncer/config.rb +9 -6
- data/lib/syncer/machine.rb +56 -53
- data/lib/syncer/synced_folder.rb +3 -1
- data/lib/syncer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f63a13b751a40347aeaa89ae2b248ddc639a240
|
4
|
+
data.tar.gz: e6cd70fd78bdf3eab3bbaf4e90b22c09714d82f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4a245961c35ebd74bff1b309835b23041061bddf57d3e2ceb866b440a71c9d0c1ee9758d74f8913f354f0a8049d26cac915f73b3dcf4b6d1572f73ce86eb01b
|
7
|
+
data.tar.gz: 3247be65105b04e43f48c3112bd392d99fbf9d49c464da73f3f985654c61ea650eafb60d0e6c74f84a6f7a4a0abd8034f5ff34e9449602268db606f9576006d9
|
data/example/Vagrantfile
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
Vagrant.configure(2) do |config|
|
5
5
|
config.vm.box = 'ubuntu/trusty64'
|
6
6
|
|
7
|
-
# Disable checking updates for faster
|
7
|
+
# Disable checking updates for faster startup.
|
8
8
|
config.vm.box_check_update = false
|
9
9
|
config.vbguest.auto_update = false if Vagrant.has_plugin?("vagrant-vbguest")
|
10
10
|
|
@@ -54,6 +54,14 @@ Vagrant.configure(2) do |config|
|
|
54
54
|
# Default: true
|
55
55
|
config.syncer.run_on_startup = true
|
56
56
|
|
57
|
+
# Whether or not to rsync on machine up before provisioners are ran.
|
58
|
+
#
|
59
|
+
# Please do note that this does not affect to the behaviour of rsync-auto,
|
60
|
+
# as it does a full rsync first anyway to get the remote up to date.
|
61
|
+
#
|
62
|
+
# Default: false
|
63
|
+
config.syncer.disable_up_rsync = false
|
64
|
+
|
57
65
|
# Whether or not to show the file system events.
|
58
66
|
# Default: false
|
59
67
|
config.syncer.show_events = false
|
data/lib/syncer/actions.rb
CHANGED
@@ -15,10 +15,9 @@ module Vagrant
|
|
15
15
|
return if @exit_registered
|
16
16
|
|
17
17
|
at_exit do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
18
|
+
exit 1 unless $!.is_a?(SystemExit)
|
19
|
+
exit_status = $!.status
|
20
|
+
exit exit_status if exit_status != 0
|
22
21
|
|
23
22
|
# If vagrant up/reload/resume exited successfully, run rsync-auto.
|
24
23
|
env[:machine].env.cli("rsync-auto")
|
data/lib/syncer/command/rsync.rb
CHANGED
@@ -46,8 +46,9 @@ module Vagrant
|
|
46
46
|
next unless machine.communicate.ready?
|
47
47
|
next unless synced_folders(machine)[:rsync]
|
48
48
|
|
49
|
-
|
50
|
-
|
49
|
+
if machine.ssh_info
|
50
|
+
Machine.new(machine).full_sync
|
51
|
+
end
|
51
52
|
end
|
52
53
|
|
53
54
|
return 0
|
@@ -37,7 +37,7 @@ module Vagrant
|
|
37
37
|
argv = parse_options(opts)
|
38
38
|
return unless argv
|
39
39
|
|
40
|
-
|
40
|
+
machine_threads = []
|
41
41
|
|
42
42
|
# Build up the paths that we need to listen to.
|
43
43
|
with_target_vms(argv) do |machine|
|
@@ -56,11 +56,15 @@ module Vagrant
|
|
56
56
|
next unless machine.communicate.ready?
|
57
57
|
next unless synced_folders(machine)[:rsync]
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
if machine.ssh_info
|
60
|
+
target_machine = Machine.new(machine)
|
61
|
+
machine_threads << Thread.new do
|
62
|
+
target_machine.full_sync
|
63
|
+
target_machine.listen(options[:poll])
|
64
|
+
end
|
65
|
+
end
|
62
66
|
end
|
63
|
-
|
67
|
+
machine_threads.each { |t| t.join }
|
64
68
|
|
65
69
|
return 0
|
66
70
|
end
|
data/lib/syncer/config.rb
CHANGED
@@ -3,25 +3,28 @@ module Vagrant
|
|
3
3
|
class Config < Vagrant.plugin(2, :config)
|
4
4
|
|
5
5
|
attr_accessor \
|
6
|
+
:disable_up_rsync,
|
7
|
+
:force_listen_gem,
|
6
8
|
:interval,
|
7
|
-
:show_events,
|
8
|
-
:ssh_args,
|
9
9
|
:run_on_startup,
|
10
|
-
:
|
10
|
+
:show_events,
|
11
|
+
:ssh_args
|
11
12
|
|
12
13
|
def initialize
|
14
|
+
@disable_up_rsync = UNSET_VALUE
|
15
|
+
@force_listen_gem = UNSET_VALUE
|
13
16
|
@interval = UNSET_VALUE
|
17
|
+
@run_on_startup = UNSET_VALUE
|
14
18
|
@show_events = UNSET_VALUE
|
15
19
|
@ssh_args = UNSET_VALUE
|
16
|
-
@run_on_startup = UNSET_VALUE
|
17
|
-
@force_listen_gem = UNSET_VALUE
|
18
20
|
end
|
19
21
|
|
20
22
|
def finalize!
|
23
|
+
@disable_up_rsync = false if @disable_up_rsync == UNSET_VALUE
|
24
|
+
@force_listen_gem = false if @force_listen_gem == UNSET_VALUE
|
21
25
|
@interval = 0.1 if @interval == UNSET_VALUE || @interval < 0.01
|
22
26
|
@run_on_startup = true if @run_on_startup == UNSET_VALUE
|
23
27
|
@show_events = false if @show_events == UNSET_VALUE
|
24
|
-
@force_listen_gem = false if @force_listen_gem == UNSET_VALUE
|
25
28
|
|
26
29
|
if @ssh_args = UNSET_VALUE
|
27
30
|
@ssh_args = [
|
data/lib/syncer/machine.rb
CHANGED
@@ -8,94 +8,97 @@ module Vagrant
|
|
8
8
|
|
9
9
|
include Vagrant::Action::Builtin::MixinSyncedFolders
|
10
10
|
|
11
|
-
def initialize(machine
|
12
|
-
@
|
11
|
+
def initialize(machine)
|
12
|
+
@machine = machine
|
13
|
+
@logger = @machine.ui
|
14
|
+
|
15
|
+
@rsync_synced_folders = synced_folders(@machine)[:rsync]
|
16
|
+
|
13
17
|
@syncers = []
|
14
|
-
@
|
15
|
-
|
18
|
+
@rsync_synced_folders.each do |id, folder_opts|
|
19
|
+
@syncers << Syncers::Rsync.new(folder_opts, @machine)
|
20
|
+
end
|
21
|
+
end
|
16
22
|
|
17
|
-
|
18
|
-
@
|
23
|
+
def full_sync
|
24
|
+
@syncers.each do |syncer|
|
25
|
+
@logger.info(I18n.t('syncer.states.initial', {
|
26
|
+
host_path: syncer.host_path,
|
27
|
+
guest_path: syncer.guest_path
|
28
|
+
}))
|
29
|
+
syncer.sync([syncer.host_path], initial=true)
|
30
|
+
end
|
31
|
+
end
|
19
32
|
|
33
|
+
def listen(polling=false)
|
34
|
+
listener_excludes = []
|
35
|
+
listener_interval = @machine.config.syncer.interval
|
36
|
+
listener_verbose = @machine.config.syncer.show_events
|
37
|
+
listener_force_listen = @machine.config.syncer.force_listen_gem
|
20
38
|
listener_settings = {
|
21
|
-
latency:
|
22
|
-
wait_for_delay:
|
39
|
+
latency: listener_interval,
|
40
|
+
wait_for_delay: listener_interval / 2
|
23
41
|
}
|
24
42
|
|
25
43
|
if polling
|
26
44
|
require_relative 'listeners/listen'
|
27
|
-
|
45
|
+
listener_class = Vagrant::Syncer::Listeners::Listen
|
28
46
|
listener_settings[:force_polling] = polling
|
29
|
-
elsif
|
47
|
+
elsif listener_force_listen
|
30
48
|
require_relative 'listeners/listen'
|
31
|
-
|
49
|
+
listener_class = Vagrant::Syncer::Listeners::Listen
|
32
50
|
else
|
33
51
|
case Vagrant::Util::Platform.platform
|
34
52
|
when /darwin/
|
35
53
|
require_relative 'listeners/fsevents'
|
36
|
-
|
54
|
+
listener_class = Vagrant::Syncer::Listeners::FSEvents
|
37
55
|
when /linux/
|
38
56
|
require_relative 'listeners/inotify'
|
39
|
-
|
57
|
+
listener_class = Vagrant::Syncer::Listeners::INotify
|
40
58
|
else
|
41
59
|
require_relative 'listeners/listen'
|
42
|
-
|
60
|
+
listener_class = Vagrant::Syncer::Listeners::Listen
|
43
61
|
end
|
44
62
|
end
|
45
63
|
|
46
|
-
|
64
|
+
paths = []
|
65
|
+
listener_excludes = []
|
66
|
+
@rsync_synced_folders.each do |id, folder_opts|
|
67
|
+
paths << File.expand_path(folder_opts[:hostpath],
|
68
|
+
@machine.env.root_path)
|
69
|
+
if folder_opts[:rsync__excludes]
|
70
|
+
listener_excludes << folder_opts[:rsync__excludes]
|
71
|
+
end
|
72
|
+
end
|
47
73
|
|
48
|
-
|
74
|
+
listener_name = listener_class.to_s.gsub(/^.*::/, '')
|
49
75
|
|
50
|
-
|
51
|
-
|
52
|
-
@
|
53
|
-
|
54
|
-
|
76
|
+
change_callback = Proc.new do |changed|
|
77
|
+
if listener_verbose
|
78
|
+
@logger.info(listener_name + ": " + changed.join(', '))
|
79
|
+
end
|
80
|
+
@syncers.each do |syncer|
|
81
|
+
syncer.sync(changed)
|
55
82
|
end
|
56
83
|
end
|
57
84
|
|
58
|
-
|
59
|
-
|
60
|
-
|
85
|
+
listener = listener_class.new(
|
86
|
+
paths,
|
87
|
+
listener_excludes,
|
61
88
|
listener_settings,
|
62
89
|
change_callback
|
63
90
|
)
|
64
|
-
end
|
65
|
-
|
66
|
-
def full_sync
|
67
|
-
@syncers.each do |syncer|
|
68
|
-
@logger.info(I18n.t('syncer.states.initial', {
|
69
|
-
host_path: syncer.host_path,
|
70
|
-
guest_path: syncer.guest_path
|
71
|
-
}))
|
72
|
-
syncer.sync([syncer.host_path], initial=true)
|
73
|
-
end
|
74
|
-
end
|
75
91
|
|
76
|
-
|
77
|
-
|
78
|
-
@paths.each do |path|
|
92
|
+
text = polling ? 'syncer.states.polling' : 'syncer.states.watching'
|
93
|
+
paths.each do |path|
|
79
94
|
@logger.info(I18n.t(text, {
|
80
95
|
host_path: path,
|
81
|
-
listener:
|
82
|
-
interval:
|
96
|
+
listener: listener_name,
|
97
|
+
interval: listener_interval
|
83
98
|
}))
|
84
99
|
end
|
85
|
-
@listener.run
|
86
|
-
end
|
87
100
|
|
88
|
-
|
89
|
-
|
90
|
-
def change_callback
|
91
|
-
Proc.new do |changed|
|
92
|
-
if @listener_verbose
|
93
|
-
@logger.info(@listener_name + ": " + changed.join(', '))
|
94
|
-
end
|
95
|
-
@syncers.each do |syncer|
|
96
|
-
syncer.sync(changed)
|
97
|
-
end
|
98
|
-
end
|
101
|
+
listener.run
|
99
102
|
end
|
100
103
|
|
101
104
|
end
|
data/lib/syncer/synced_folder.rb
CHANGED
data/lib/syncer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-syncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anssi Syrjäsalo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|