vagrant-syncer 1.0.5 → 1.0.6

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: 203811d9ebeabc6d7b97875a159f3697e48815b3
4
- data.tar.gz: bd5e7b41b4b7fe99d533e19a7a2012d555597591
3
+ metadata.gz: 6b1cb649b133b1b2e72687523107f780915461ce
4
+ data.tar.gz: 099ae1ef55605d4d25cd0c6bf051b02f5c0fecfb
5
5
  SHA512:
6
- metadata.gz: 83fb4ca0d48cc3e457cbc34c354de41f5ea91bb7c08a17c2943303fec6da0d2bfdd0c3dee27aa0487b885cd8cc35ee1b65bfc155381df73b0a319daf5dede2b8
7
- data.tar.gz: 86ff7c6020bf5b3285fac3cb5930654e002b660e95a4ec7c7ac0b6409271235f4748e0b42dedbe2bab642de70ebe9cd39cbfa518fb51513059945a1d247f7971
6
+ metadata.gz: a0f8891268b87fd26378200efa3d395e4d29c9ae2f8a9d050c8613ec30888f0c9557a6e25973db877e525150955c324cd42a487fb6118e3af3968110c7d7214d
7
+ data.tar.gz: d634602c568ab7bd9039f719da9fc01f7d82c2b92209475aad01c89de0722ae476e5d1ce66183c99f376e5496518cecb3eee767e400771a3a8cbb92a7a308d5e
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # vagrant syncer
2
2
 
3
- A Vagrant synced folder plugin that is an optimized implementation of [Vagrant rsync(-auto)](https://github.com/mitchellh/vagrant/tree/b721eb62cfbfa93895d0d4cf019436ab6b1df05d/plugins/synced_folders/rsync), based heavily on [vagrant-gatling-rsync](https://github.com/smerrill/vagrant-gatling-rsync)'s great listener implementations for watching large hierarchies.
3
+ This Vagrant plugin optimizes to the following Vagrant commands to not
4
+ be that CPU hog with large file hierachies:
4
5
 
5
- Vagrant syncer forks [Vagrant's RsyncHelper](https://github.com/mitchellh/vagrant/blob/b721eb62cfbfa93895d0d4cf019436ab6b1df05d/plugins/synced_folders/rsync/helper.rb)
6
- to make it (c)leaner, instead of using the class like [vagrant-gatling-rsync](https://github.com/smerrill/vagrant-gatling-rsync) does.
6
+ vagrant rsync
7
+ vagrant rsync-auto
7
8
 
8
- If the optimizations seem to work in heavy use, I'll see if (some of) them can
9
- be merged to Vagrant core and be submitted as pull requests to
10
- [the official Vagrant repo](https://github.com/mitchellh/vagrant).
9
+ All the [rsync synced folder settings](https://docs.vagrantup.com/v2/synced-folders/rsync.html)
10
+ are supported. They also have the same default values for backwards compatibility.
11
11
 
12
12
 
13
13
  ## Installation
@@ -15,43 +15,43 @@ be merged to Vagrant core and be submitted as pull requests to
15
15
  vagrant plugin install vagrant-syncer
16
16
 
17
17
 
18
- ## Configuration
18
+ ## Updating
19
19
 
20
- All the [rsync synced folder settings](https://docs.vagrantup.com/v2/synced-folders/rsync.html)
21
- are supported. They also have the same default values.
20
+ vagrant plugin update vagrant-syncer
21
+
22
+
23
+ ## Configuration
22
24
 
23
25
  See [the example Vagrantfile](https://github.com/asyrjasalo/vagrant-syncer/blob/master/example/Vagrantfile)
24
26
  for additional plugin specific ```config.syncer``` settings and their default
25
27
  values.
26
28
 
27
29
 
28
- ## Usage
29
-
30
- The plugin replaces the following stock commands:
31
-
32
- vagrant rsync
33
- vagrant rsync-auto
34
-
35
- ## Improvements over the stock commands
30
+ ## Changes to the Vagrant's rsync and rsync-auto
36
31
 
37
32
  - The plugin has leaner rsync implementation with most of the rsync command
38
33
  argument constructing already handled in the class initializer and not
39
- sync-time
34
+ sync-time (in the sync loop).
40
35
  - Uses [rb-fsevent](https://github.com/thibaudgg/rb-fsevent) and
41
36
  [rb-inotify](https://github.com/nex3/rb-inotify) gems underneath for
42
37
  performance on OS X and GNU/Linux respectively, instead of using Listen.
43
- On Windows, Listen is used though as using wdm still needs some testing.
38
+ On Windows, Listen is used though as using plain wdm gem requires some tests.
44
39
  - Allow defining additional SSH arguments to rsync in Vagrantfile using
45
- ```config.syncer.ssh_args```. This can be used for e.g. disabling SSH
46
- compression to lower CPU overhead.
40
+ ```config.syncer.ssh_args```. Use this for e.g. disabling SSH compression to
41
+ lower CPU overhead.
47
42
  - Runs ```vagrant rsync-auto``` to start watching changes after vagrant up,
48
43
  reload and resume, if ```config.syncer.run_on_startup``` set to ```true```
49
- in Vagrantfile
44
+ in Vagrantfile.
50
45
  - Vagrant's implementation assumes that the primary group of the SSH user
51
46
  has the same name as the user, if rsync option ```group``` is not explicitly
52
47
  defined. This plugin queries the user's real primary group from the guest.
53
48
  - Hooking Vagrant's ```:rsync_pre``` is removed, as this unnecessarily runs mkdir
54
49
  to create the target directory, which rsync command creates sync-time anyway.
50
+ - On Windows, expect relative paths, instead of Cygwin style, as Cygwin shall
51
+ not be a requirement.
52
+ - 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
+ - The rsync stdout outputs are all single line by default, and colored.
55
55
 
56
56
 
57
57
  ## Development
@@ -72,7 +72,7 @@ Or outside the bundle:
72
72
  ./build_and_install.sh
73
73
  vagrant rsync-auto
74
74
 
75
- I'll kindly take pull requests as well.
75
+ Also, I kindly take pull requests.
76
76
 
77
77
  ## Credits
78
78
 
@@ -12,7 +12,7 @@ module Vagrant
12
12
 
13
13
  return unless env[:machine].config.syncer.run_on_startup
14
14
 
15
- # If Vagrant up/reload/resume exited successfully, run this rsync-auto
15
+ # If vagrant up/reload/resume exited successfully, run rsync-auto.
16
16
  at_exit do
17
17
  env[:machine].env.cli("rsync-auto") if $!.status == 0
18
18
  end
@@ -29,7 +29,7 @@ module Vagrant
29
29
  argv = parse_options(opts)
30
30
  return if !argv
31
31
 
32
- # Go through each machine and perform the rsync
32
+ # Go through each machine and perform full sync.
33
33
  error = false
34
34
  with_target_vms(argv) do |machine|
35
35
  if machine.provider.capability?(:proxy_machine)
@@ -5,7 +5,7 @@ require "vagrant/action/builtin/mixin_synced_folders"
5
5
  require "vagrant/util/platform"
6
6
 
7
7
 
8
- # This is to avoid a bug in nio 1.0.0. Remove around nio 1.0.1
8
+ # This is to avoid a bug in nio 1.0.0. Remove around nio 1.0.1.
9
9
  ENV["NIO4R_PURE"] = "1" if Vagrant::Util::Platform.windows?
10
10
 
11
11
  module Vagrant
@@ -45,8 +45,8 @@ module Vagrant
45
45
  machine.ui.warn(I18n.t(
46
46
  "vagrant.rsync_proxy_machine",
47
47
  name: machine.name.to_s,
48
- provider: machine.provider_name.to_s))
49
-
48
+ provider: machine.provider_name.to_s
49
+ ))
50
50
  machine = proxy
51
51
  end
52
52
  end
data/lib/syncer/config.rb CHANGED
@@ -23,6 +23,8 @@ module Vagrant
23
23
  '-o UserKnownHostsFile=/dev/null',
24
24
  ]
25
25
 
26
+ # ControlPaths seem to fail on Windows with Vagrant >= 1.8.0.
27
+ # See: https://github.com/mitchellh/vagrant/issues/7046
26
28
  unless Vagrant::Util::Platform.windows?
27
29
  @ssh_args += [
28
30
  '-o ControlMaster=auto',
@@ -9,7 +9,7 @@ module Vagrant
9
9
  @absolute_path = absolute_path
10
10
  @settings = settings.merge!(no_defer: false)
11
11
  @callback = callback
12
- # rb-fsevent does not support excludes
12
+ # rb-fsevent does not support excludes.
13
13
  end
14
14
 
15
15
  def run
@@ -9,7 +9,7 @@ module Vagrant
9
9
  @absolute_path = absolute_path
10
10
  @settings = settings
11
11
  @callback = callback
12
- # rb-inotify does not support excludes
12
+ # rb-inotify does not support excludes.
13
13
  end
14
14
 
15
15
  def run
@@ -46,7 +46,7 @@ module Vagrant
46
46
  Thread.new { queue << true }
47
47
  end
48
48
 
49
- # Run the listener in a busy block, exit once we receive an interrupt
49
+ # Run the listener in a busy block, exit once we receive an interrupt.
50
50
  Vagrant::Util::Busy.busy(callback) do
51
51
  listener.start
52
52
  queue.pop
data/lib/syncer/plugin.rb CHANGED
@@ -23,6 +23,7 @@ module Vagrant
23
23
  Vagrant::Syncer::Command::RsyncAuto
24
24
  end
25
25
 
26
+ # For backwards compatibility with earlier vagrant-syncer versions.
26
27
  command("syncer", primary: false) do
27
28
  require_relative "command/rsync_auto"
28
29
  Vagrant::Syncer::Command::RsyncAuto
@@ -12,7 +12,8 @@ module Vagrant
12
12
 
13
13
  @machine_path = machine.env.root_path.to_s
14
14
  @host_path = parse_host_path(path_opts[:hostpath])
15
- @rsync_args = parse_rsync_args(path_opts[:rsync__args], path_opts[:rsync__rsync_path])
15
+ @rsync_args = parse_rsync_args(path_opts[:rsync__args],
16
+ path_opts[:rsync__rsync_path])
16
17
  @rsync_verbose = path_opts[:rsync__verbose] || false
17
18
  @ssh_command = parse_ssh_command(machine.config.syncer.ssh_args)
18
19
  @exclude_args = parse_exclude_args(path_opts[:rsync__exclude])
@@ -73,7 +74,7 @@ module Vagrant
73
74
  return
74
75
  end
75
76
 
76
- # Set owner/group after the files are transferred
77
+ # Set owner and group after the files are transferred.
77
78
  if @machine.guest.capability?(:rsync_post)
78
79
  @machine.guest.capability(:rsync_post, @vagrant_rsync_opts)
79
80
  end
@@ -85,12 +86,13 @@ module Vagrant
85
86
  abs_host_path = File.expand_path(host_dir, @machine_path)
86
87
  abs_host_path = Vagrant::Util::Platform.fs_real_path(abs_host_path).to_s
87
88
 
88
- # Rsync on Windows expects relative paths
89
+ # Rsync on Windows to use relative paths and not to expect Cygwin.
89
90
  if Vagrant::Util::Platform.windows?
90
91
  abs_host_path = abs_host_path.gsub(@machine_path + '/', '')
91
92
  end
92
93
 
93
- # Ensure path ends with '/' to prevent creating directory inside directory
94
+ # Ensure the path ends with '/' to prevent creating a directory
95
+ # inside a directory.
94
96
  abs_host_path += "/" if !abs_host_path.end_with?("/")
95
97
 
96
98
  abs_host_path
@@ -98,7 +100,7 @@ module Vagrant
98
100
 
99
101
  def parse_exclude_args(excludes=nil)
100
102
  excludes ||= []
101
- excludes << '.vagrant/' # in any case, exclude .vagrant directory
103
+ excludes << '.vagrant/' # Always exclude .vagrant directory.
102
104
  excludes.uniq.map { |e| ["--exclude", e] }
103
105
  end
104
106
 
@@ -120,24 +122,28 @@ module Vagrant
120
122
  rsync_args ||= ["--archive", "--delete", "--compress", "--copy-links",
121
123
  "--verbose"]
122
124
 
123
- # This is the default rsync output unless overridden by user
125
+ # The default rsync output, later user opt --out-format arguments
126
+ # take presence.
124
127
  rsync_args.unshift("--out-format=%L%n")
125
128
 
126
- rsync_chmod_args_given = rsync_args.any? { |arg| arg.start_with?("--chmod=") }
129
+ rsync_chmod_args_given = rsync_args.any? { |arg|
130
+ arg.start_with?("--chmod=")
131
+ }
127
132
 
128
- # On Windows, enable all non-masked bits to avoid permission issues
133
+ # On Windows, enable all non-masked bits to avoid permission issues.
129
134
  if Vagrant::Util::Platform.windows? && !rsync_chmod_args_given
130
135
  rsync_args << "--chmod=ugo=rwX"
131
136
 
132
- # Remove the -p option if --archive (equals -rlptgoD) is given
133
- # Otherwise new files won't get the destination-default permissions
137
+ # Remove the -p option if --archive (equals -rlptgoD) is given.
138
+ # Otherwise new files won't get the destination's default
139
+ # permissions.
134
140
  if rsync_args.include?("--archive") || rsync_args.include?("-a")
135
141
  rsync_args << "--no-perms"
136
142
  end
137
143
  end
138
144
 
139
- # Disable rsync's owner/group preservation (implied by --archive) unless
140
- # explicitly requested, since we adjust owner/group later ourselves
145
+ # Disable rsync's owner and group preservation (implied by --archive)
146
+ # unless explicitly wanted, since we set owner/group using sudo rsync.
141
147
  unless rsync_args.include?("--owner") || rsync_args.include?("-o")
142
148
  rsync_args << "--no-owner"
143
149
  end
@@ -145,7 +151,7 @@ module Vagrant
145
151
  rsync_args << "--no-group"
146
152
  end
147
153
 
148
- # Invoke remote rsync with sudo to allow owner and group settings to work
154
+ # Invoke remote rsync with sudo to allow chowning.
149
155
  if !rsync_path && @machine.guest.capability?(:rsync_command)
150
156
  rsync_path = @machine.guest.capability(:rsync_command)
151
157
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Syncer
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Vagrant::Syncer::VERSION
9
9
  spec.authors = ["Anssi Syrjäsalo"]
10
10
  spec.email = ["anssi.syrjasalo@gmail.com"]
11
- spec.summary = %q{Optimized Vagrant rsync-auto}
12
- spec.description = %q{Optimized Vagrant rsync(-auto) plugin for large file hierarchies.}
11
+ spec.summary = %q{Less resource-hog Vagrant rsync and rsync-auto}
12
+ spec.description = %q{Optimized rsync and rsync-auto for large file hierarchies.}
13
13
  spec.homepage = "https://github.com/asyrjasalo/vagrant-syncer"
14
14
  spec.license = "MIT"
15
15
 
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.5
4
+ version: 1.0.6
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-09 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Optimized Vagrant rsync(-auto) plugin for large file hierarchies.
41
+ description: Optimized rsync and rsync-auto for large file hierarchies.
42
42
  email:
43
43
  - anssi.syrjasalo@gmail.com
44
44
  executables:
@@ -111,5 +111,5 @@ rubyforge_project:
111
111
  rubygems_version: 2.4.5.1
112
112
  signing_key:
113
113
  specification_version: 4
114
- summary: Optimized Vagrant rsync-auto
114
+ summary: Less resource-hog Vagrant rsync and rsync-auto
115
115
  test_files: []