vagrant-gatling-rsync 0.0.3 → 1.0

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
- SHA1:
3
- metadata.gz: 874e00d6caf6487664c49d27f97208fcea7f015c
4
- data.tar.gz: 26c34bedc9e1936f71a22dcd9950c175e5d3ac54
2
+ SHA256:
3
+ metadata.gz: 5368b19e16b2b8df288dc7642548fe58edb2fc87e1a2271dc18cfeaec73d8c87
4
+ data.tar.gz: b127ae31cc1008cc08d7dd4a0b11389eb6868eadd9698b0b042cb7fdc4be9168
5
5
  SHA512:
6
- metadata.gz: 9f57f6c8a0c5d559302a44afa669995e821212f1842dd2d550531bd34d92eb670f35e4c3c5828a19ee3c3cfbcd5f2fc3aeeeb44c64e862e36edcc34b585c7249
7
- data.tar.gz: cf8b9867b09ef3de6eb8b0b32be938a56e2b59b2fa6f6e36e81b45de12885fe23ca48cfe44275108a9105282d9b28c1f9a69a5654216095ae5fa87369e75de12
6
+ metadata.gz: 45078bf2419e1a16b43a36e8ca3390a783d3883ce59d24c014d9a04b5b30447bf3ae5b06a8c9c0f7ae509346da555b6ace9319bb174c3d21a8e72be4148bb047
7
+ data.tar.gz: 9fa69af2debff371a39a7eca2a9c47925ea42b1cf09349548cdb828ca99eff6f23d043e08cccfcb358411be74074e1a404d6a3dcd4faba09e30631931d00f6ec
@@ -1 +1 @@
1
- 2.0.0-p353
1
+ 2.6.2
@@ -1,3 +1,53 @@
1
+ ## 1.0 (June 02, 2020)
2
+
3
+ This release adds compatibility with Vagrant 2.2.5+.
4
+
5
+ Small parts of the example Vagrantfile and the Gemfile and Gemspec have also been cleaned up.
6
+
7
+ FEATURES:
8
+
9
+ - Add compatibility with Vagrant 2.2.5+. Thanks to @leejo for the PR. [GH-37]
10
+
11
+ ## 0.9.0 (June 28, 2015)
12
+
13
+ This release adds two big features: Windows support and automatic sync on startup.
14
+
15
+ It also adds the `config.gatling.rsync_on_startup` configuration option to turn automatic rsync on startup off if you
16
+ do not want it.
17
+
18
+ It also updates the Gemfile to use Vagrant 1.7.2 for development. The gem should still work with Vagrant 1.5.1+.
19
+
20
+ FEATURES:
21
+
22
+ - Add support for Windows. Thanks to @mfradcourt for wiring it up. [GH-21]
23
+ - Add automatic sync startup on `vagrant up` or `vagrant reload` if rsync folders are present. [GH-14]
24
+
25
+ ## 0.1.0 (January 04, 2015)
26
+
27
+ This release adds feature parity with Vagrant core rsync-auto by doing a sync when gatling-rsync is started.
28
+
29
+ FEATURES:
30
+
31
+ - Perform an initial rsync when the watcher starts. [GH-13]
32
+
33
+ ## 0.0.4 (August 24, 2014)
34
+
35
+ This release adds notification of time and duration of rsyncs.
36
+
37
+ It also adds the `config.gatling.time_format` configuration option to allow customization of the time format string when
38
+ time information is printed to the console.
39
+
40
+ It also updates the Gemfile to use Vagrant 1.6.4 so that I can test on Linux using the Docker provider. This should not
41
+ have any impact on using the gem with 1.5.1+ versions of Vagrant, however.
42
+
43
+ FEATURES:
44
+
45
+ - Add output to note when an rsync finishes and how long it took. [GH-7, GH-10]
46
+
47
+ BUG FIXES:
48
+
49
+ - The plugin now correctly outputs an error instead of failing to load on Vagrant versions < 1.5.1. [GH-11]
50
+
1
51
  ## 0.0.3 (May 02, 2014)
2
52
 
3
53
  Bugfix release.
data/Gemfile CHANGED
@@ -4,10 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v1.5.1'
7
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v2.2.9'
8
8
  end
9
9
 
10
10
  group :plugins do
11
- gem "vagrant-gatling-rsync", path: "."
11
+ gemspec
12
12
  end
13
13
 
data/README.md CHANGED
@@ -5,8 +5,8 @@ potential cost of more rsync actions.
5
5
 
6
6
  ## Getting started
7
7
 
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.
8
+ To get started, you need to have Vagrant 1.5.1 installed on your Linux, Mac, or
9
+ Windows host machine. To install the plugin, use the following command.
10
10
 
11
11
  ```bash
12
12
  vagrant plugin install vagrant-gatling-rsync
@@ -17,6 +17,11 @@ vagrant plugin install vagrant-gatling-rsync
17
17
  Add the following information to the Vagrantfile to set the coalescing
18
18
  threshold in seconds. If you do not set it, it will default to 1.5.
19
19
 
20
+ You may also specify what
21
+ [Time.strftime](http://www.ruby-doc.org/core-2.0.0/Time.html#method-i-strftime)
22
+ options the plugin will use when it reports on completed rsyncs. The default is
23
+ "%I:%M:%S %p".
24
+
20
25
  You will also need to have at least one synced folder set to type "rsync"
21
26
  to use the plugin.
22
27
 
@@ -32,7 +37,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
32
37
  # Configure the window for gatling to coalesce writes.
33
38
  if Vagrant.has_plugin?("vagrant-gatling-rsync")
34
39
  config.gatling.latency = 2.5
40
+ config.gatling.time_format = "%H:%M:%S"
35
41
  end
42
+
43
+ # Automatically sync when machines with rsync folders come up.
44
+ config.gatling.rsync_on_startup = true
36
45
  end
37
46
  ```
38
47
 
@@ -43,6 +52,11 @@ command to sync files.
43
52
  vagrant gatling-rsync-auto
44
53
  ```
45
54
 
55
+ As of version 0.9.0, vagrant-gatling-rsync will automatically start the sync
56
+ engine on `vagrant up` or `vagrant reload` when the machines that you bring up
57
+ have one or more rsync folders defined. You can disable this behavior by
58
+ setting `config.gatling.rsync_on_startup` to false.
59
+
46
60
  ## Why "gatling"?
47
61
 
48
62
  The gatling gun was the first gun capable of firing continuously.
@@ -5,17 +5,42 @@
5
5
  VAGRANTFILE_API_VERSION = "2"
6
6
 
7
7
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
- config.vm.box = "hashicorp/precise64"
8
+ config.vm.box = "centos/7"
9
9
 
10
- # Share an additional folder to the guest VM. The first argument is
11
- # the path on the host to the actual folder. The second argument is
12
- # the path on the guest to mount the folder. And the optional third
13
- # argument is a set of non-required options.
14
- config.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
15
- rsync__exclude: [".git/", ".idea/"]
10
+ config.vm.provider "docker" do |d, override|
11
+ d.image = "smerrill/vagrant-centos"
12
+ d.has_ssh = true
13
+
14
+ # This is needed if you have non-Docker provisioners in the Vagrantfile.
15
+ override.vm.box = nil
16
+ end
17
+
18
+ config.vm.provider "lxc" do |d, override|
19
+ override.vm.box = "smerrill/centos-7"
20
+ end
21
+
22
+ # When using gatling rsync in your projects, you should wrap these configs in
23
+ # an 'if Vagrant.has_plugin?("vagrant-gatling-rsync")' test.
16
24
 
17
25
  # Configure the window for gatling to coalesce writes.
18
- if Vagrant.has_plugin?("vagrant-gatling-rsync")
19
- config.gatling.latency = 2.5
26
+ config.gatling.latency = 0.4
27
+ config.gatling.time_format = "%H:%M:%S"
28
+
29
+ # Gatling rsync will run `vagrant gatling-rsync-auto` after the machines in
30
+ # your Vagrant environment start unles you set this to false.
31
+ config.gatling.rsync_on_startup = true
32
+
33
+ # Add a multi-box setup.
34
+ config.vm.define "rsync", primary: true do |m|
35
+ m.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
36
+ rsync__exclude: [".git/", ".idea/"]
37
+ end
38
+
39
+ config.vm.define "rsync2", primary: true do |m|
40
+ m.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
41
+ rsync__exclude: [".git/", ".idea/"]
42
+ end
43
+
44
+ config.vm.define "norsync" do |m|
20
45
  end
21
46
  end
@@ -1,5 +1,5 @@
1
1
  # This file is required because Vagrant's plugin system expects
2
- # a eponymous ruby file matching the rubygem.
2
+ # an eponymous ruby file matching the rubygem.
3
3
  #
4
4
  # So this gem is called 'vagrant-gatling-rsync' and thus vagrant tries
5
5
  # to require "vagrant-gatling-rsync"
@@ -14,6 +14,7 @@ module VagrantPlugins
14
14
  autoload :Errors, lib_path.join("errors")
15
15
  autoload :ListenOSX, lib_path.join("listen/listenosx")
16
16
  autoload :ListenLinux, lib_path.join("listen/listenlinux")
17
+ autoload :ListenWindows, lib_path.join("listen/listenwindows")
17
18
 
18
19
  # This returns the path to the source of this plugin.
19
20
  #
@@ -0,0 +1,48 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module GatlingRsync
5
+ class StartupRsync
6
+ include Vagrant::Action::Builtin::MixinSyncedFolders
7
+
8
+ def initialize(app, env)
9
+ @app = app
10
+ @gatling_startup_registered = false
11
+ @rsync_folder_count = 0
12
+ end
13
+
14
+ def call(env)
15
+ folders = synced_folders(env[:machine])
16
+ @rsync_folder_count += folders[:rsync].size if folders.key?(:rsync)
17
+
18
+ @app.call(env)
19
+
20
+ # Ensure only one at_exit block is registered.
21
+ return unless @gatling_startup_registered == false
22
+
23
+ return unless env[:machine].config.gatling.rsync_on_startup == true
24
+
25
+ at_exit do
26
+ unless $!.is_a?(SystemExit)
27
+ env[:ui].warn "Vagrant's startup was interrupted by an exception."
28
+ exit 1
29
+ end
30
+
31
+ exit_status = $!.status
32
+ if exit_status != 0
33
+ env[:ui].warn "The previous process exited with exit code #{exit_status}."
34
+ exit exit_status
35
+ end
36
+
37
+ # Don't run if there are no rsynced folders.
38
+ unless @rsync_folder_count == 0 then
39
+ env[:ui].info I18n.t("vagrant_gatling_rsync.startup_sync")
40
+ env[:machine].env.cli("gatling-rsync-auto")
41
+ end
42
+ end
43
+
44
+ @gatling_startup_registered = true
45
+ end
46
+ end
47
+ end
48
+ end
@@ -6,6 +6,12 @@ require "vagrant"
6
6
  module VagrantPlugins
7
7
  module GatlingRsync
8
8
  class GatlingRsyncAuto < Vagrant.plugin(2, :command)
9
+ # This is a sanity check to make sure no one is attempting to install
10
+ # this into an early Vagrant version.
11
+ if Vagrant::VERSION < "1.5.1"
12
+ raise Errors::Vagrant15RequiredError
13
+ end
14
+
9
15
  include Vagrant::Action::Builtin::MixinSyncedFolders
10
16
 
11
17
  def self.synopsis
@@ -35,6 +41,16 @@ module VagrantPlugins
35
41
  folders = synced_folders(machine)[:rsync]
36
42
  next if !folders || folders.empty?
37
43
 
44
+ # Get the SSH info for this machine so we can do an initial
45
+ # sync to the VM, just as core `vagrant rsync-auto` does.
46
+ ssh_info = machine.ssh_info
47
+ if ssh_info
48
+ machine.ui.info(I18n.t("vagrant.rsync_auto_initial"))
49
+ folders.each do |id, folder_opts|
50
+ VagrantPlugins::SyncedFolderRSync::RsyncHelper.rsync_single(machine, ssh_info, folder_opts)
51
+ end
52
+ end
53
+
38
54
  folders.each do |id, folder_opts|
39
55
  # If we marked this folder to not auto sync, then
40
56
  # don't do it.
@@ -51,7 +67,11 @@ module VagrantPlugins
51
67
 
52
68
  if folder_opts[:exclude]
53
69
  Array(folder_opts[:exclude]).each do |pattern|
54
- ignores << VagrantPlugins::SyncedFolderRSync::RsyncHelper.exclude_to_regexp(hostpath, pattern.to_s)
70
+ if Vagrant::VERSION < "2.2.5"
71
+ ignores << VagrantPlugins::SyncedFolderRSync::RsyncHelper.exclude_to_regexp(hostpath, pattern.to_s)
72
+ else
73
+ ignores << VagrantPlugins::SyncedFolderRSync::RsyncHelper.exclude_to_regexp(pattern.to_s)
74
+ end
55
75
  end
56
76
  end
57
77
  end
@@ -78,9 +98,11 @@ module VagrantPlugins
78
98
  ListenOSX.new(paths, ignores, latency, @logger, self.method(:callback)).run
79
99
  when /linux/
80
100
  ListenLinux.new(paths, ignores, latency, @logger, self.method(:callback)).run
101
+ when /cygwin|mswin|mingw|bccwin|wince|emx/
102
+ ListenWindows.new(paths, ignores, latency, @logger, self.method(:callback)).run
81
103
  else
82
104
  # @TODO: Raise this earlier?
83
- raise Errors::OnlyOSXLinuxSupportError
105
+ raise Errors::OSNotSupportedError
84
106
  end
85
107
 
86
108
  0
@@ -121,12 +143,20 @@ module VagrantPlugins
121
143
  tosync.each do |folders|
122
144
  folders.each do |opts|
123
145
  ssh_info = opts[:machine].ssh_info
124
- if ssh_info
125
- VagrantPlugins::SyncedFolderRSync::RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
126
- end
146
+ do_rsync(opts[:machine], ssh_info, opts[:opts]) if ssh_info
127
147
  end
128
148
  end
129
149
  end
150
+
151
+ def do_rsync(machine, ssh_info, opts)
152
+ start_time = Time.new
153
+ VagrantPlugins::SyncedFolderRSync::RsyncHelper.rsync_single(machine, ssh_info, opts)
154
+ end_time = Time.new
155
+ machine.ui.info(I18n.t(
156
+ "vagrant_gatling_rsync.gatling_ran",
157
+ date: end_time.strftime(machine.config.gatling.time_format),
158
+ milliseconds: (end_time - start_time) * 1000))
159
+ end
130
160
  end
131
161
  end
132
162
  end
@@ -2,15 +2,25 @@ require "vagrant"
2
2
 
3
3
  module VagrantPlugins
4
4
  module GatlingRsync
5
- class Config < Vagrant.plugin("2", :config)
5
+ class Config < Vagrant.plugin(2, :config)
6
6
  attr_accessor :latency
7
+ attr_accessor :time_format
8
+ attr_accessor :rsync_on_startup
7
9
 
8
10
  def initialize
9
11
  @latency = UNSET_VALUE
12
+ @time_format = UNSET_VALUE
13
+ @rsync_on_startup = UNSET_VALUE
10
14
  end
11
15
 
12
16
  def finalize!
13
17
  @latency = 1.5 if @latency == UNSET_VALUE
18
+ @time_format = "%I:%M:%S %p" if @time_format == UNSET_VALUE
19
+ if @rsync_on_startup == UNSET_VALUE
20
+ @rsync_on_startup = true
21
+ else
22
+ @rsync_on_startup = !!@rsync_on_startup
23
+ end
14
24
  end
15
25
 
16
26
  # @TODO: This does not appear to be called.
@@ -7,8 +7,8 @@ module VagrantPlugins
7
7
  error_namespace("vagrant_gatling_rsync.errors")
8
8
  end
9
9
 
10
- class OnlyOSXLinuxSupportError < VagrantGatlingRsyncError
11
- error_key(:only_osx_linux_support)
10
+ class OSNotSupportedError < VagrantGatlingRsyncError
11
+ error_key(:os_not_supported)
12
12
  end
13
13
 
14
14
  class Vagrant15RequiredError < VagrantGatlingRsyncError
@@ -18,7 +18,7 @@ module VagrantPlugins
18
18
  monitor = WDM::Monitor.new
19
19
  changes = Queue.new
20
20
  @paths.keys.each do |path|
21
- monitor.watch_recursively(path) { |change| changes << change }
21
+ monitor.watch_recursively(path.dup) { |change| changes << change }
22
22
  end
23
23
  Thread.new { monitor.run! }
24
24
 
@@ -4,15 +4,9 @@ rescue LoadError
4
4
  raise "The Vagrant gatling rsync plugin must be run within Vagrant."
5
5
  end
6
6
 
7
- # This is a sanity check to make sure no one is attempting to install
8
- # this into an early Vagrant version.
9
- if Vagrant::VERSION < "1.5.1"
10
- raise Errors::Vagrant15RequiredError
11
- end
12
-
13
7
  module VagrantPlugins
14
8
  module GatlingRsync
15
- class Plugin < Vagrant.plugin("2")
9
+ class Plugin < Vagrant.plugin(2)
16
10
  name "Gatling Rsync"
17
11
  description <<-DESC
18
12
  Rsync large project directories to your Vagrant VM without using many resources on the host.
@@ -24,6 +18,12 @@ module VagrantPlugins
24
18
  I18n.reload!
25
19
  end
26
20
 
21
+ action_hook "startup-rsync" do |hook|
22
+ setup_i18n
23
+ require_relative "action/startup_rsync"
24
+ hook.after Vagrant::Action::Builtin::SyncedFolders, StartupRsync
25
+ end
26
+
27
27
  command "gatling-rsync-auto" do
28
28
  setup_i18n
29
29
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GatlingRsync
3
- VERSION = "0.0.3"
3
+ VERSION = "1.0"
4
4
  end
5
5
  end
@@ -1,8 +1,12 @@
1
1
  en:
2
2
  vagrant_gatling_rsync:
3
+ gatling_ran: |-
4
+ %{date}: The rsync operation completed in %{milliseconds} milliseconds.
5
+ startup_sync: |-
6
+ vagrant-gatling-rsync is starting the sync engine because you have at least one rsync folder. To disable this behavior, set `config.gatling.rsync_on_startup = false` in your Vagrantfile.
3
7
  errors:
4
- only_osx_linux_support: |-
5
- This plugin currently only supports Max OS X and Linux hosts.
8
+ os_not_supported: |-
9
+ The vagrant-gatling-rsync plugin does not support your OS.
6
10
  vagrant_15_required: |-
7
- This plugin requires Vagrant 1.5.1 or newer to function.
11
+ The vagrant-gatling-rsync plugin requires Vagrant 1.5.1 or newer to function.
8
12
 
@@ -13,13 +13,11 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
- # @TODO: Remove example files from the built gem.
17
- spec.files = `git ls-files -z`.split("\x0")
16
+ spec.files = `git ls-files -z`.split("\x0").reject {|f| f.start_with?('example/files')}
18
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
19
  spec.require_paths = ["lib"]
21
20
 
22
- spec.add_development_dependency "bundler", "~> 1.5"
23
21
  spec.add_development_dependency "rake"
24
22
  spec.add_development_dependency "pry"
25
23
  end
metadata CHANGED
@@ -1,55 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-gatling-rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: '1.0'
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-05-02 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.5'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '1.5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - '>='
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
19
  version: '0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - '>='
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: pry
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '>='
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
33
  version: '0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '>='
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  description: The gatling-rsync plugin runs on Mac and Linux and is far less CPU-intensive
@@ -60,16 +46,16 @@ executables: []
60
46
  extensions: []
61
47
  extra_rdoc_files: []
62
48
  files:
63
- - .gitignore
64
- - .ruby-version
49
+ - ".gitignore"
50
+ - ".ruby-version"
65
51
  - CHANGELOG.md
66
52
  - Gemfile
67
53
  - LICENSE
68
54
  - README.md
69
55
  - Rakefile
70
- - example/files/.gitkeep
71
56
  - example/vagrant/Vagrantfile
72
57
  - lib/vagrant-gatling-rsync.rb
58
+ - lib/vagrant-gatling-rsync/action/startup_rsync.rb
73
59
  - lib/vagrant-gatling-rsync/command/rsync_auto.rb
74
60
  - lib/vagrant-gatling-rsync/config.rb
75
61
  - lib/vagrant-gatling-rsync/errors.rb
@@ -90,17 +76,16 @@ require_paths:
90
76
  - lib
91
77
  required_ruby_version: !ruby/object:Gem::Requirement
92
78
  requirements:
93
- - - '>='
79
+ - - ">="
94
80
  - !ruby/object:Gem::Version
95
81
  version: '0'
96
82
  required_rubygems_version: !ruby/object:Gem::Requirement
97
83
  requirements:
98
- - - '>='
84
+ - - ">="
99
85
  - !ruby/object:Gem::Version
100
86
  version: '0'
101
87
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.0.14
88
+ rubygems_version: 3.0.3
104
89
  signing_key:
105
90
  specification_version: 4
106
91
  summary: A lighter-weight Vagrant plugin for watching and rsyncing directories.