vagrant-gatling-rsync 0.1.0 → 0.2.0.beta.1

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: 3079b3b7c888e7bda1b89a82387084d3de085590
4
- data.tar.gz: 2a939070a1391b74cc679c25eff274a7ade8b9b2
3
+ metadata.gz: e9e1559210c5d53464d5743885ac7165583e2e02
4
+ data.tar.gz: e98378351c68c501c0f5f9ce2651354f0e311cf7
5
5
  SHA512:
6
- metadata.gz: f4cdaf03871c33d5d851809c23a5e5aebd1efa15c9fe41a11abd226dfceedd590a806cc7dfe9c87b03df3d80b64d77fd800670a640fe879027474798a12a152f
7
- data.tar.gz: ba6ffa6a2719b0b95e81f1fbbeebb943097658ee1724b9a5872b25c0087a2da71391c12ddfbbb70a16cd03705055653246381251a8fe803eb52613ecd7bfe7de
6
+ metadata.gz: 3f6b6b2e9f9acdb5df864d295cfcf114992e108a171ff0ca1c1efce2f53da11123c45454e73ac31a2711b64b5673a9505ba577a04136b133a319ce6dcf8c2775
7
+ data.tar.gz: f7fd3be884f09f4f0aa8f9e24e793715e9fcdc02bafe859b40d0b994dbb14c14917c2dd8cc84a915abbc726c127742c9bc9f0627f0f4d339c2da5503b7dbc5b9
@@ -26,9 +26,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
26
26
  config.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
27
27
  rsync__exclude: [".git/", ".idea/"]
28
28
 
29
- # Configure the window for gatling to coalesce writes. Note that when using
30
- # outside of a development environment like this one, you should wrap these
31
- # statements in an 'if Vagrant.has_plugin?("vagrant-gatling-rsync")' test.
29
+ # When using gatling rsync in your projects, you should wrap these configs in
30
+ # an 'if Vagrant.has_plugin?("vagrant-gatling-rsync")' test.
31
+
32
+ # Configure the window for gatling to coalesce writes.
32
33
  config.gatling.latency = 0.4
33
34
  config.gatling.time_format = "%H:%M:%S"
35
+
36
+ # Gatling rsync can run `vagrant gatling-rsync-auto` after the machines in
37
+ # your Vagrant environment start if you set this to true.
38
+ config.gatling.rsync_on_startup = true
34
39
  end
@@ -0,0 +1,40 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module GatlingRsync
5
+ class StartupRsync
6
+ def initialize(app, env)
7
+ @app = app
8
+ @gatling_startup_registered = false
9
+ end
10
+
11
+ def call(env)
12
+ @app.call(env)
13
+
14
+ # Ensure only one at_exit block is registered.
15
+ return unless @gatling_startup_registered == false
16
+
17
+ return unless env[:machine].config.gatling.rsync_on_startup == true
18
+
19
+ at_exit do
20
+ unless $!.is_a?(SystemExit)
21
+ env[:ui].warn "Vagrant's startup was interrupted by an exception."
22
+ exit 1
23
+ end
24
+
25
+ exit_status = $!.status
26
+ if exit_status != 0
27
+ env[:ui].warn "The previous process exited with exit code #{exit_status}."
28
+ exit exit_status
29
+ end
30
+
31
+ # @TODO: Translate.
32
+ env[:ui].info "Invoking gatling-rsync-auto."
33
+ env[:machine].env.cli("gatling-rsync-auto")
34
+ end
35
+
36
+ @gatling_startup_registered = true
37
+ end
38
+ end
39
+ end
40
+ end
@@ -5,15 +5,22 @@ module VagrantPlugins
5
5
  class Config < Vagrant.plugin(2, :config)
6
6
  attr_accessor :latency
7
7
  attr_accessor :time_format
8
+ attr_accessor :rsync_on_startup
8
9
 
9
10
  def initialize
10
11
  @latency = UNSET_VALUE
11
12
  @time_format = UNSET_VALUE
13
+ @rsync_on_startup = UNSET_VALUE
12
14
  end
13
15
 
14
16
  def finalize!
15
17
  @latency = 1.5 if @latency == UNSET_VALUE
16
18
  @time_format = "%I:%M:%S %p" if @time_format == UNSET_VALUE
19
+ if @rsync_on_startup == UNSET_VALUE
20
+ @rsync_on_startup = false
21
+ else
22
+ @rsync_on_startup = !!@rsync_on_startup
23
+ end
17
24
  end
18
25
 
19
26
  # @TODO: This does not appear to be called.
@@ -18,6 +18,11 @@ module VagrantPlugins
18
18
  I18n.reload!
19
19
  end
20
20
 
21
+ action_hook "startup-rsync" do |hook|
22
+ require_relative "action/startup_rsync"
23
+ hook.after Vagrant::Action::Builtin::SyncedFolders, StartupRsync
24
+ end
25
+
21
26
  command "gatling-rsync-auto" do
22
27
  setup_i18n
23
28
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GatlingRsync
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0.beta.1"
4
4
  end
5
5
  end
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.1.0
4
+ version: 0.2.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Merrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-04 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,7 @@ files:
83
83
  - Rakefile
84
84
  - example/vagrant/Vagrantfile
85
85
  - lib/vagrant-gatling-rsync.rb
86
+ - lib/vagrant-gatling-rsync/action/startup_rsync.rb
86
87
  - lib/vagrant-gatling-rsync/command/rsync_auto.rb
87
88
  - lib/vagrant-gatling-rsync/config.rb
88
89
  - lib/vagrant-gatling-rsync/errors.rb
@@ -108,12 +109,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
109
  version: '0'
109
110
  required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - '>='
112
+ - - '>'
112
113
  - !ruby/object:Gem::Version
113
- version: '0'
114
+ version: 1.3.1
114
115
  requirements: []
115
116
  rubyforge_project:
116
- rubygems_version: 2.1.11
117
+ rubygems_version: 2.0.14
117
118
  signing_key:
118
119
  specification_version: 4
119
120
  summary: A lighter-weight Vagrant plugin for watching and rsyncing directories.