vagrant-gatling-rsync 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGELOG.txt → CHANGELOG.md} +9 -0
- data/Gemfile +0 -1
- data/README.md +49 -37
- data/example/vagrant/Vagrantfile +3 -1
- data/lib/vagrant-gatling-rsync/listen/listenlinux.rb +2 -2
- data/lib/vagrant-gatling-rsync/listen/listenosx.rb +3 -3
- data/lib/vagrant-gatling-rsync/listen/listenwindows.rb +37 -24
- data/lib/vagrant-gatling-rsync/plugin.rb +1 -1
- data/lib/vagrant-gatling-rsync/version.rb +1 -1
- data/locales/en.yml +1 -1
- data/vagrant-gatling-rsync.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7354f9501fc4cbac38522002f0187aadb11875dc
|
4
|
+
data.tar.gz: 5f071e14f37ff5cb463da802c82159cf576a73ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e814d5190b5e3b2c678798b147c314ffd775aacc4b7d53301ba02de95679e8fdf1de7ccd247433bc87679176e91751b3c8cf1db6643e3400c01ac7d7349f9d72
|
7
|
+
data.tar.gz: 908e73d45901906eda295fbf26dcad64852e7468670c1819e3f8075472e171631c8da533f81645dc878d1271673a711e57f3061bc04e9c4dab7b6237c1b9531e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,47 @@
|
|
1
1
|
# vagrant-gatling-rsync
|
2
2
|
|
3
|
-
An rsync watcher for Vagrant 1.5+ that uses fewer host resources at the
|
3
|
+
An rsync watcher for Vagrant 1.5.1+ that uses fewer host resources at the
|
4
4
|
potential cost of more rsync actions.
|
5
5
|
|
6
|
-
##
|
6
|
+
## Getting started
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
To get started, you need to have Vagrant 1.5.1 installed on your Linux or
|
9
|
+
Mac OS X host machine. To install the plugin, use the following command.
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
```bash
|
12
|
+
vagrant plugin install vagrant-gatling-rsync
|
13
|
+
```
|
14
|
+
|
15
|
+
## Working with this plugin
|
16
|
+
|
17
|
+
Add the following information to the Vagrantfile to set the coalescing
|
18
|
+
threshold in seconds. If you do not set it, it will default to 1.5.
|
19
|
+
|
20
|
+
You will also need to have at least one synced folder set to type "rsync"
|
21
|
+
to use the plugin.
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
VAGRANTFILE_API_VERSION = "2"
|
25
|
+
|
26
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
27
|
+
config.vm.box = "hashicorp/precise64"
|
28
|
+
|
29
|
+
config.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
|
30
|
+
rsync__exclude: [".git/", ".idea/"]
|
31
|
+
|
32
|
+
# Configure the window for gatling to coalesce writes.
|
33
|
+
if Vagrant.has_plugin?("vagrant-gatling-rsync")
|
34
|
+
config.gatling.latency = 2.5
|
35
|
+
end
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
With the Vagrantfile configured in this fashion, you can run the following
|
40
|
+
command to sync files.
|
41
|
+
|
42
|
+
```bash
|
43
|
+
vagrant gatling-rsync-auto
|
44
|
+
```
|
14
45
|
|
15
46
|
## Why "gatling"?
|
16
47
|
|
@@ -37,37 +68,18 @@ APIs, which allows for higher performance.
|
|
37
68
|
## Event coalescing
|
38
69
|
|
39
70
|
This plugin also coalesces events for you. The default latency is 1.5 seconds.
|
40
|
-
|
41
|
-
latency of two seconds, this plugin will not fire a
|
42
|
-
contiguous seconds without file events have passed.
|
43
|
-
happening if many writes are happening on the host
|
44
|
-
`git clone`, for example) until the activity has leveled off.
|
45
|
-
|
46
|
-
## Working with this plugin
|
47
|
-
|
48
|
-
Add the following information to the Vagrantfile to set the coalescing
|
49
|
-
threshold in seconds. If you do not set it, it will default to 1.5.
|
50
|
-
|
51
|
-
You will also need to have at least one synced folder set to type "rsync"
|
52
|
-
to use the plugin.
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
VAGRANTFILE_API_VERSION = "2"
|
56
|
-
|
57
|
-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
58
|
-
config.vm.box = "hashicorp/precise64"
|
71
|
+
It is configurable through the `config.gatling.latency` parameter.
|
72
|
+
If you specify a latency of two seconds, this plugin will not fire a
|
73
|
+
`vagrant rsync` until two contiguous seconds without file events have passed.
|
74
|
+
This will delay rsyncs from happening if many writes are happening on the host
|
75
|
+
(during a `make` or a `git clone`, for example) until the activity has leveled off.
|
59
76
|
|
60
|
-
|
61
|
-
rsync__exclude: [".git/", ".idea/"]
|
77
|
+
## Authors
|
62
78
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
```
|
79
|
+
Steven Merrill (@stevenmerrill) originally had the idea to tap into rb-fsevent
|
80
|
+
and rb-inotify to more efficiently rsync files.
|
67
81
|
|
68
|
-
|
69
|
-
|
82
|
+
Doug Marcey (@dougmarcey) provided considerable guidance in the implementation
|
83
|
+
of the coalescing functionality and wrote the initial sketch of the Linux and
|
84
|
+
Windows adapters.
|
70
85
|
|
71
|
-
```bash
|
72
|
-
vagrant gatling-rsync-auto
|
73
|
-
```
|
data/example/vagrant/Vagrantfile
CHANGED
@@ -15,5 +15,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
15
15
|
rsync__exclude: [".git/", ".idea/"]
|
16
16
|
|
17
17
|
# Configure the window for gatling to coalesce writes.
|
18
|
-
|
18
|
+
if Vagrant.has_plugin?("vagrant-gatling-rsync")
|
19
|
+
config.gatling.latency = 2.5
|
20
|
+
end
|
19
21
|
end
|
@@ -19,10 +19,10 @@ module VagrantPlugins
|
|
19
19
|
notifier.watch(path, :modify, :create, :delete, :recursive) {}
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
loop do
|
23
23
|
directories = Set.new
|
24
24
|
begin
|
25
|
-
|
25
|
+
loop do
|
26
26
|
events = []
|
27
27
|
events = Timeout::timeout(@latency) {
|
28
28
|
notifier.read_events
|
@@ -28,17 +28,17 @@ module VagrantPlugins
|
|
28
28
|
end
|
29
29
|
Thread.new { fsevent.run }
|
30
30
|
|
31
|
-
|
31
|
+
loop do
|
32
32
|
directories = Set.new
|
33
33
|
begin
|
34
|
-
|
34
|
+
loop do
|
35
35
|
@logger.info("Starting the timeout at #{Time.now.to_s}.")
|
36
36
|
change = Timeout::timeout(@latency) {
|
37
37
|
changes.pop
|
38
38
|
}
|
39
39
|
directories << change unless change.nil?
|
40
40
|
end
|
41
|
-
rescue Timeout::Error
|
41
|
+
rescue Timeout::Error, ThreadError
|
42
42
|
@logger.info("Breaking out of the loop at #{Time.now.to_s}.")
|
43
43
|
end
|
44
44
|
|
@@ -1,33 +1,46 @@
|
|
1
1
|
# @TODO: Note that this is entirely untested and not yet implemented.
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "thread"
|
3
|
+
require "wdm"
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
module VagrantPlugins
|
6
|
+
module GatlingRsync
|
7
|
+
class ListenWindows
|
8
|
+
def initialize(paths, ignores, latency, logger, callback)
|
9
|
+
@paths = paths
|
10
|
+
@ignores = ignores
|
11
|
+
@latency = latency
|
12
|
+
@logger = logger
|
13
|
+
@callback = callback
|
14
|
+
end
|
8
15
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
def run
|
17
|
+
@logger.info("Listening via: WDM on Windows.")
|
18
|
+
monitor = WDM::Monitor.new
|
19
|
+
changes = Queue.new
|
20
|
+
@paths.keys.each do |path|
|
21
|
+
monitor.watch_recursively(path) { |change| changes << change }
|
22
|
+
end
|
23
|
+
Thread.new { monitor.run! }
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
loop do
|
26
|
+
directories = Set.new
|
27
|
+
begin
|
28
|
+
loop do
|
29
|
+
change = Timeout::timeout(@latency) {
|
30
|
+
changes.pop
|
31
|
+
}
|
32
|
+
directories << change.path
|
33
|
+
end
|
34
|
+
rescue Timeout::Error
|
35
|
+
@logger.info("Breaking out of the loop at #{Time.now.to_s}.")
|
36
|
+
end
|
28
37
|
|
29
|
-
|
38
|
+
@logger.info(directories.inspect) unless directories.empty?
|
30
39
|
|
31
|
-
|
40
|
+
@callback.call(@paths, @ignores, directories) unless directories.empty?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
32
45
|
end
|
33
46
|
|
data/locales/en.yml
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Steven Merrill"]
|
10
10
|
spec.email = ["steven.merrill@gmail.com"]
|
11
11
|
spec.summary = %q{A lighter-weight Vagrant plugin for watching and rsyncing directories.}
|
12
|
-
spec.description = %q{The gatling-rsync plugin
|
12
|
+
spec.description = %q{The gatling-rsync plugin runs on Mac and Linux and is far less CPU-intensive than the built-in rsync-auto.}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-gatling-rsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Merrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,9 +52,8 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: The gatling-rsync plugin
|
56
|
-
|
57
|
-
rsyncing more often.
|
55
|
+
description: The gatling-rsync plugin runs on Mac and Linux and is far less CPU-intensive
|
56
|
+
than the built-in rsync-auto.
|
58
57
|
email:
|
59
58
|
- steven.merrill@gmail.com
|
60
59
|
executables: []
|
@@ -63,7 +62,7 @@ extra_rdoc_files: []
|
|
63
62
|
files:
|
64
63
|
- .gitignore
|
65
64
|
- .ruby-version
|
66
|
-
- CHANGELOG.
|
65
|
+
- CHANGELOG.md
|
67
66
|
- Gemfile
|
68
67
|
- LICENSE
|
69
68
|
- README.md
|