vagrant-gatling-rsync 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d981cfb603768c87a0a307b415b32acf4fdacc27
4
- data.tar.gz: 7517d55a2e0be0a9d6fc04c7ae60c15262ebc82d
3
+ metadata.gz: 7354f9501fc4cbac38522002f0187aadb11875dc
4
+ data.tar.gz: 5f071e14f37ff5cb463da802c82159cf576a73ca
5
5
  SHA512:
6
- metadata.gz: 6e0938d9cc6f4e67da39c1865c004b348a7ef03451ed8b93086af4dff9706101dee20a5313c4006153803588edd4def025b538a2c0fb9e1779404ad880dfb992
7
- data.tar.gz: 176593bea18b5cc114ebd0f9ce944ccfe7c7438beb128ea738e770056ee38cc0301ede1641bfcacbcf339ea599008cc8d159f26396dda8a55cdac798692fdce6
6
+ metadata.gz: e814d5190b5e3b2c678798b147c314ffd775aacc4b7d53301ba02de95679e8fdf1de7ccd247433bc87679176e91751b3c8cf1db6643e3400c01ac7d7349f9d72
7
+ data.tar.gz: 908e73d45901906eda295fbf26dcad64852e7468670c1819e3f8075472e171631c8da533f81645dc878d1271673a711e57f3061bc04e9c4dab7b6237c1b9531e
@@ -1,3 +1,12 @@
1
+ ## 0.0.2 (April 27, 2014)
2
+
3
+ Bugfix release.
4
+
5
+ BUG FIXES:
6
+
7
+ - Catch ThreadErrors (this sometimes happens in practice on OS X.)
8
+ - Reflect that this plugin requires Vagrant 1.5.1+.
9
+
1
10
  ## 0.0.1 (March 23, 2014)
2
11
 
3
12
  Initial release.
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v1.5.1'
8
- gem "pry"
9
8
  end
10
9
 
11
10
  group :plugins do
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
- ## Authors
6
+ ## Getting started
7
7
 
8
- Steven Merrill (@stevenmerrill) originally had the idea to tap into rb-fsevent
9
- and rb-inotify to more efficiently rsync files.
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
- Doug Marcey (@dougmarcey) provided considerable guidance in the implementation
12
- of the coalescing functionality and wrote the initial sketch of the Linux and
13
- Windows adapters.
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
- (This will be a configurable option in future versions.) If you specify a
41
- latency of two seconds, this plugin will not fire a `vagrant rsync` until two
42
- contiguous seconds without file events have passed. This will delay rsyncs from
43
- happening if many writes are happening on the host (during a `make` or a
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
- config.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
61
- rsync__exclude: [".git/", ".idea/"]
77
+ ## Authors
62
78
 
63
- # Configure the window for gatling to coalesce writes.
64
- config.gatling.latency = 2.5
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
- With the Vagrantfile configured in this fashion, you can run the following
69
- command to sync files.
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
- ```
@@ -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
- config.gatling.latency = 2.5
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
- while true do
22
+ loop do
23
23
  directories = Set.new
24
24
  begin
25
- while true do
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
- while true do
31
+ loop do
32
32
  directories = Set.new
33
33
  begin
34
- while true do
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 "timeout"
4
- require "thread"
3
+ require "wdm"
5
4
 
6
- paths = {"/path/to/a/directory" => {}}
7
- latency = 2
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
- monitor = WDM::Monitor.new
10
- changes = Queue.new
11
- paths.keys.each do |path|
12
- monitor.watch_recursively(path) { |change| changes << change }
13
- end
14
- Thread.new { monitor.run! }
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
- while true do
17
- directories = Set.new
18
- begin
19
- while true do
20
- change = Timeout::timeout(latency) {
21
- changes.pop
22
- }
23
- directories << change.path
24
- end
25
- rescue Timeout::Error
26
- @logger.info("Breaking out of the loop at #{Time.now.to_s}.")
27
- end
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
- @logger.info(directories.inspect) unless directories.empty?
38
+ @logger.info(directories.inspect) unless directories.empty?
30
39
 
31
- #@callback.call(paths, ignores, directories) unless directories.empty?
40
+ @callback.call(@paths, @ignores, directories) unless directories.empty?
41
+ end
42
+ end
43
+ end
44
+ end
32
45
  end
33
46
 
@@ -6,7 +6,7 @@ end
6
6
 
7
7
  # This is a sanity check to make sure no one is attempting to install
8
8
  # this into an early Vagrant version.
9
- if Vagrant::VERSION < "1.5.0"
9
+ if Vagrant::VERSION < "1.5.1"
10
10
  raise Errors::Vagrant15RequiredError
11
11
  end
12
12
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GatlingRsync
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -4,5 +4,5 @@ en:
4
4
  only_osx_linux_support: |-
5
5
  This plugin currently only supports Max OS X and Linux hosts.
6
6
  vagrant_15_required: |-
7
- This plugin requires Vagrant 1.5 or newer to function.
7
+ This plugin requires Vagrant 1.5.1 or newer to function.
8
8
 
@@ -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 run on Mac (and soon on Linux) and is far less CPU-intensive than the built-in 'vagrant rsync-auto' plugin, at the cost of possibly rsyncing more often.}
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.1
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-03-24 00:00:00.000000000 Z
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 run on Mac (and soon on Linux) and is far less
56
- CPU-intensive than the built-in 'vagrant rsync-auto' plugin, at the cost of possibly
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.txt
65
+ - CHANGELOG.md
67
66
  - Gemfile
68
67
  - LICENSE
69
68
  - README.md