vagrant-syncer 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -10
- data/example/Vagrantfile +21 -16
- data/lib/syncer/config.rb +13 -6
- data/lib/syncer/listeners/fsevents.rb +2 -8
- data/lib/syncer/listeners/inotify.rb +1 -11
- data/lib/syncer/listeners/listen.rb +2 -13
- data/lib/syncer/path.rb +6 -1
- data/lib/syncer/syncers/rsync.rb +2 -2
- 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: b63ad4d5959b021a757e370b28dc00afbaf17fdb
|
4
|
+
data.tar.gz: 28100efa5de0c18e4bfb87f3877afaf8b233bf29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ecc08db460cfd9f6925024ec4e707e98eeb4b0ac52e196adaf4c990bc2a21cbab638144b85be24e2cf2a3571554bacdaa31693a13e4b210543e95d10a896558
|
7
|
+
data.tar.gz: e714a252e4669fd01c7439043513ea5219e7c636f408805752cdeddd28859bfbfd708c7cad5a525d008907135964262d5114267424db8b0cf4c3aaf4afe70dec
|
data/README.md
CHANGED
@@ -45,18 +45,22 @@ values.
|
|
45
45
|
- Vagrant's implementation assumes that the primary group of the SSH user
|
46
46
|
has the same name as the user, if rsync option ```group``` is not explicitly
|
47
47
|
defined. This plugin queries the user's real primary group from the guest.
|
48
|
-
- Hooking Vagrant's ```:rsync_pre``` is removed, as this unnecessarily runs
|
49
|
-
to create the target directory, which rsync command creates sync-time
|
48
|
+
- Hooking Vagrant's ```:rsync_pre``` is removed, as this unnecessarily runs
|
49
|
+
mkdir to create the target directory, which rsync command creates sync-time
|
50
|
+
anyway.
|
50
51
|
- On Windows, expect relative paths, instead of Cygwin style, as Cygwin shall
|
51
52
|
not be a requirement.
|
52
53
|
- ControlPath settings are not in the default SSH arguments on Windows,
|
53
|
-
as they fail on
|
54
|
+
as they fail on
|
55
|
+
[Vagrant 1.8.0 and 1.8.1](https://github.com/mitchellh/vagrant/issues/7046).
|
56
|
+
- Hide "permanently added to the known hosts" messages from rsync stderr output.
|
54
57
|
- The rsync stdout outputs are all single line by default, and colored.
|
55
58
|
|
56
59
|
|
57
60
|
## Development
|
58
61
|
|
59
|
-
Fork this repository, clone it and install Ruby 2.2.3, using e.g.
|
62
|
+
Fork this repository, clone it and install Ruby 2.2.3, using e.g.
|
63
|
+
[rbenv](https://github.com/sstephenson/rbenv):
|
60
64
|
|
61
65
|
cd vagrant-syncer
|
62
66
|
rbenv install $(cat .ruby-version)
|
@@ -76,11 +80,15 @@ Also, I kindly take pull requests.
|
|
76
80
|
|
77
81
|
## Credits
|
78
82
|
|
79
|
-
[vagrant-syncer](https://github.com/asyrjasalo/vagrant-syncer) was originally
|
83
|
+
[vagrant-syncer](https://github.com/asyrjasalo/vagrant-syncer) was originally
|
84
|
+
put together by Anssi Syrjäsalo.
|
80
85
|
|
81
|
-
Thanks to [Steven Merrill's](https://github.com/smerrill) (@stevenmerrill)
|
82
|
-
|
83
|
-
|
86
|
+
Thanks to [Steven Merrill's](https://github.com/smerrill) (@stevenmerrill)
|
87
|
+
[vagrant-gatling-rsync](https://github.com/smerrill/vagrant-gatling-rsync) for
|
88
|
+
[the listener implementations](https://github.com/smerrill/vagrant-gatling-rsync/tree/master/lib/vagrant-gatling-rsync/listen) and the original idea to tap into [rb-fsevent](https://github.com/thibaudgg/rb-fsevent)
|
89
|
+
(OS X) and [rb-inotify](https://github.com/nex3/rb-inotify) (GNU/Linux) for
|
90
|
+
non-CPU hog watching of hierarchies with 10,000-100,000 files.
|
84
91
|
|
85
|
-
And to [Hashicorp](https://github.com/hashicorp) for
|
86
|
-
|
92
|
+
And to [Hashicorp](https://github.com/hashicorp) for
|
93
|
+
[Vagrant](https://github.com/mitchellh/vagrant), even though its future will
|
94
|
+
likely be overshadowed by [Otto](https://github.com/hashicorp/otto).
|
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 start up.
|
8
8
|
config.vm.box_check_update = false
|
9
9
|
config.vbguest.auto_update = false if Vagrant.has_plugin?("vagrant-vbguest")
|
10
10
|
|
@@ -35,30 +35,35 @@ Vagrant.configure(2) do |config|
|
|
35
35
|
|
36
36
|
### Vagrant syncer specific settings are introduced below
|
37
37
|
|
38
|
-
# How often
|
39
|
-
# Default: 0.
|
40
|
-
config.syncer.interval = 0.
|
38
|
+
# How often, in seconds, to read file system events.
|
39
|
+
# Default: 0.1. Minimum is 0.01.
|
40
|
+
config.syncer.interval = 0.1
|
41
41
|
|
42
|
-
# Whether or not to start
|
42
|
+
# Whether or not to start rsync-auto after the machine is up, reloaded or
|
43
|
+
# resumed.
|
43
44
|
# Default: true
|
44
45
|
config.syncer.run_on_startup = true
|
45
46
|
|
46
|
-
# Whether or not to show the file system events
|
47
|
+
# Whether or not to show the file system events.
|
47
48
|
# Default: false
|
48
49
|
config.syncer.show_events = false
|
49
50
|
|
50
|
-
#
|
51
|
+
# Whether or not to force using Listen gem, on OS X and Linux distros as well.
|
52
|
+
# Default: false
|
53
|
+
config.syncer.force_listen_gem = false
|
54
|
+
|
55
|
+
# Optional SSH arguments passed to rsync, e.g. to cut down CPU load.
|
51
56
|
#
|
52
|
-
# If not
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
57
|
+
# If config.syncer.ssh_args are not given, the defaults on all platforms are:
|
58
|
+
# -o StrictHostKeyChecking=no
|
59
|
+
# -o IdentitiesOnly=true
|
60
|
+
# -o UserKnownHostsFile=/dev/null
|
61
|
+
#
|
62
|
+
# On non-Windows OSes, the defaults also include these:
|
63
|
+
# -o ControlMaster=auto
|
64
|
+
# -o ControlPath=<path_in_temp>
|
65
|
+
# -o ControlPersist=10m
|
56
66
|
#
|
57
|
-
# On non-Windows operating systems, the defaults also include the following:
|
58
|
-
# -o ControlMaster=auto
|
59
|
-
# -o ControlPath=<path_in_temp>
|
60
|
-
# -o ControlPersist=10m
|
61
|
-
|
62
67
|
config.syncer.ssh_args = [
|
63
68
|
'-o StrictHostKeyChecking=no',
|
64
69
|
'-o IdentitiesOnly=true',
|
data/lib/syncer/config.rb
CHANGED
@@ -2,19 +2,26 @@ module Vagrant
|
|
2
2
|
module Syncer
|
3
3
|
class Config < Vagrant.plugin(2, :config)
|
4
4
|
|
5
|
-
attr_accessor
|
5
|
+
attr_accessor \
|
6
|
+
:interval,
|
7
|
+
:show_events,
|
8
|
+
:ssh_args,
|
9
|
+
:run_on_startup,
|
10
|
+
:force_listen_gem
|
6
11
|
|
7
12
|
def initialize
|
8
|
-
@interval
|
9
|
-
@show_events
|
10
|
-
@ssh_args
|
11
|
-
@run_on_startup
|
13
|
+
@interval = UNSET_VALUE
|
14
|
+
@show_events = UNSET_VALUE
|
15
|
+
@ssh_args = UNSET_VALUE
|
16
|
+
@run_on_startup = UNSET_VALUE
|
17
|
+
@force_listen_gem = UNSET_VALUE
|
12
18
|
end
|
13
19
|
|
14
20
|
def finalize!
|
15
|
-
@interval = 0.
|
21
|
+
@interval = 0.1 if @interval == UNSET_VALUE || @interval < 0.01
|
16
22
|
@run_on_startup = true if @run_on_startup == UNSET_VALUE
|
17
23
|
@show_events = false if @show_events == UNSET_VALUE
|
24
|
+
@force_listen_gem = false if @force_listen_gem == UNSET_VALUE
|
18
25
|
|
19
26
|
if @ssh_args = UNSET_VALUE
|
20
27
|
@ssh_args = [
|
@@ -22,14 +22,8 @@ module Vagrant
|
|
22
22
|
|
23
23
|
loop do
|
24
24
|
directories = Set.new
|
25
|
-
|
26
|
-
|
27
|
-
change = Timeout::timeout(@settings[:latency]) { changes.pop }
|
28
|
-
directories << change unless change.nil?
|
29
|
-
end
|
30
|
-
rescue Timeout::Error, ThreadError
|
31
|
-
end
|
32
|
-
|
25
|
+
change = changes.pop
|
26
|
+
directories << change unless change.nil?
|
33
27
|
@callback.call(directories.to_a) unless directories.empty?
|
34
28
|
end
|
35
29
|
end
|
@@ -18,17 +18,7 @@ module Vagrant
|
|
18
18
|
|
19
19
|
loop do
|
20
20
|
directories = Set.new
|
21
|
-
|
22
|
-
loop do
|
23
|
-
events = []
|
24
|
-
events = Timeout::timeout(@settings[:latency]) {
|
25
|
-
notifier.read_events
|
26
|
-
}
|
27
|
-
events.each { |e| directories << e.absolute_name }
|
28
|
-
end
|
29
|
-
rescue Timeout::Error
|
30
|
-
end
|
31
|
-
|
21
|
+
notifier.read_events.each { |e| directories << e.absolute_name }
|
32
22
|
@callback.call(directories.to_a) unless directories.empty?
|
33
23
|
end
|
34
24
|
end
|
@@ -33,7 +33,6 @@ module Vagrant
|
|
33
33
|
@settings[:ignore!] << self.class.excludes_to_listen(pattern.to_s)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
36
|
end
|
38
37
|
|
39
38
|
def run
|
@@ -41,19 +40,9 @@ module Vagrant
|
|
41
40
|
@callback.call(mod + add + rem)
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
Thread.new { queue << true }
|
47
|
-
end
|
48
|
-
|
49
|
-
# Run the listener in a busy block, exit once we receive an interrupt.
|
50
|
-
Vagrant::Util::Busy.busy(callback) do
|
51
|
-
listener.start
|
52
|
-
queue.pop
|
53
|
-
listener.stop if listener.state != :stopped
|
54
|
-
end
|
43
|
+
listener.start
|
44
|
+
sleep
|
55
45
|
end
|
56
|
-
|
57
46
|
end
|
58
47
|
end
|
59
48
|
end
|
data/lib/syncer/path.rb
CHANGED
@@ -15,15 +15,20 @@ module Vagrant
|
|
15
15
|
@listener_polling = listener_polling
|
16
16
|
@listener_verbose = machine.config.syncer.show_events
|
17
17
|
@listener_interval = machine.config.syncer.interval
|
18
|
+
@force_listen_gem = machine.config.syncer.force_listen_gem
|
18
19
|
|
19
20
|
listener_settings = {
|
20
|
-
latency: @listener_interval
|
21
|
+
latency: @listener_interval,
|
22
|
+
wait_for_delay: @listener_interval / 2
|
21
23
|
}
|
22
24
|
|
23
25
|
if @listener_polling
|
24
26
|
require_relative 'listeners/listen'
|
25
27
|
@listener_class = Vagrant::Syncer::Listeners::Listen
|
26
28
|
listener_settings[:force_polling] = @listener_polling
|
29
|
+
elsif @force_listen_gem
|
30
|
+
require_relative 'listeners/listen'
|
31
|
+
@listener_class = Vagrant::Syncer::Listeners::Listen
|
27
32
|
else
|
28
33
|
case Vagrant::Util::Platform.platform
|
29
34
|
when /darwin/
|
data/lib/syncer/syncers/rsync.rb
CHANGED
@@ -58,9 +58,9 @@ module Vagrant
|
|
58
58
|
result = Vagrant::Util::Subprocess.execute(*rsync_vagrant_command) do |io_name, data|
|
59
59
|
data.each_line do |line|
|
60
60
|
if io_name == :stdout
|
61
|
-
@logger.success("
|
61
|
+
@logger.success("Rsynced: #{line}")
|
62
62
|
elsif io_name == :stderr && !line =~ /Permanently added/
|
63
|
-
@logger.warn("Rsync: #{line}")
|
63
|
+
@logger.warn("Rsync stderr'ed: #{line}")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
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.0.
|
4
|
+
version: 1.0.7
|
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-03-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|