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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b1cb649b133b1b2e72687523107f780915461ce
4
- data.tar.gz: 099ae1ef55605d4d25cd0c6bf051b02f5c0fecfb
3
+ metadata.gz: b63ad4d5959b021a757e370b28dc00afbaf17fdb
4
+ data.tar.gz: 28100efa5de0c18e4bfb87f3877afaf8b233bf29
5
5
  SHA512:
6
- metadata.gz: a0f8891268b87fd26378200efa3d395e4d29c9ae2f8a9d050c8613ec30888f0c9557a6e25973db877e525150955c324cd42a487fb6118e3af3968110c7d7214d
7
- data.tar.gz: d634602c568ab7bd9039f719da9fc01f7d82c2b92209475aad01c89de0722ae476e5d1ce66183c99f376e5496518cecb3eee767e400771a3a8cbb92a7a308d5e
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 mkdir
49
- to create the target directory, which rsync command creates sync-time anyway.
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 [Vagrant 1.8.0 and 1.8.1](https://github.com/mitchellh/vagrant/issues/7046).
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. [rbenv](https://github.com/sstephenson/rbenv):
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 put together by Anssi Syrjäsalo.
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) [vagrant-gatling-rsync](https://github.com/smerrill/vagrant-gatling-rsync)
82
- for [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) (OS X)
83
- and [rb-inotify](https://github.com/nex3/rb-inotify) (GNU/Linux) for non-CPU hog watching of hierarchies with 10,000-100,000 files.
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 [Vagrant](https://github.com/mitchellh/vagrant), even though its
86
- future will likely be overshadowed by [Otto](https://github.com/hashicorp/otto).
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 testing
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 (in seconds) to read file system events
39
- # Default: 0.2. Minimum accepted value is 0.2.
40
- config.syncer.interval = 0.2
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 watching after the machine is up, reloaded or resumed
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
- # Optional SSH arguments passed to rsync, e.g. to lower CPU load
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 overridden here, the defaults on all platforms are:
53
- # -o StrictHostKeyChecking=no
54
- # -o IdentitiesOnly=true
55
- # -o UserKnownHostsFile=/dev/null
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 :interval, :run_on_startup, :show_events, :ssh_args
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 = UNSET_VALUE
9
- @show_events = UNSET_VALUE
10
- @ssh_args = UNSET_VALUE
11
- @run_on_startup = UNSET_VALUE
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.2 if @interval == UNSET_VALUE || @interval <= 0.2
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
- begin
26
- loop do
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
- begin
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
- queue = Queue.new
45
- callback = lambda do
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/
@@ -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("Rsync: #{line}")
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
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Syncer
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.7"
4
4
  end
5
5
  end
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.6
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-10 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler