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 +4 -4
- data/README.md +23 -23
- data/lib/syncer/actions.rb +1 -1
- data/lib/syncer/command/rsync.rb +1 -1
- data/lib/syncer/command/rsync_auto.rb +3 -3
- data/lib/syncer/config.rb +2 -0
- data/lib/syncer/listeners/fsevents.rb +1 -1
- data/lib/syncer/listeners/inotify.rb +1 -1
- data/lib/syncer/listeners/listen.rb +1 -1
- data/lib/syncer/plugin.rb +1 -0
- data/lib/syncer/syncers/rsync.rb +19 -13
- data/lib/syncer/version.rb +1 -1
- data/vagrant-syncer.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b1cb649b133b1b2e72687523107f780915461ce
|
4
|
+
data.tar.gz: 099ae1ef55605d4d25cd0c6bf051b02f5c0fecfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0f8891268b87fd26378200efa3d395e4d29c9ae2f8a9d050c8613ec30888f0c9557a6e25973db877e525150955c324cd42a487fb6118e3af3968110c7d7214d
|
7
|
+
data.tar.gz: d634602c568ab7bd9039f719da9fc01f7d82c2b92209475aad01c89de0722ae476e5d1ce66183c99f376e5496518cecb3eee767e400771a3a8cbb92a7a308d5e
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# vagrant syncer
|
2
2
|
|
3
|
-
|
3
|
+
This Vagrant plugin optimizes to the following Vagrant commands to not
|
4
|
+
be that CPU hog with large file hierachies:
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
vagrant rsync
|
7
|
+
vagrant rsync-auto
|
7
8
|
|
8
|
-
|
9
|
-
|
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
|
-
##
|
18
|
+
## Updating
|
19
19
|
|
20
|
-
|
21
|
-
|
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
|
-
##
|
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
|
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```.
|
46
|
-
|
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
|
75
|
+
Also, I kindly take pull requests.
|
76
76
|
|
77
77
|
## Credits
|
78
78
|
|
data/lib/syncer/actions.rb
CHANGED
@@ -12,7 +12,7 @@ module Vagrant
|
|
12
12
|
|
13
13
|
return unless env[:machine].config.syncer.run_on_startup
|
14
14
|
|
15
|
-
# If
|
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
|
data/lib/syncer/command/rsync.rb
CHANGED
@@ -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
|
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',
|
@@ -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
data/lib/syncer/syncers/rsync.rb
CHANGED
@@ -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],
|
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
|
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
|
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
|
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/' #
|
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
|
-
#
|
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|
|
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
|
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
|
140
|
-
# explicitly
|
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
|
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
|
data/lib/syncer/version.rb
CHANGED
data/vagrant-syncer.gemspec
CHANGED
@@ -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{
|
12
|
-
spec.description = %q{Optimized
|
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.
|
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-
|
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
|
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:
|
114
|
+
summary: Less resource-hog Vagrant rsync and rsync-auto
|
115
115
|
test_files: []
|