vagrant-gatling-rsync 0.0.4 → 1.0.1

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: f7e90735d5b30fc728ce9def9abc606eba65a780
4
- data.tar.gz: 97ffd1da36b10c33132168c0cacf6f68219f9520
2
+ SHA256:
3
+ metadata.gz: 2c450f1e3f93ee70f51a9a7d6e690bedfeb9c3d2747643a62293e05738201439
4
+ data.tar.gz: e31847e72bb85082c301639890f6c108e902320a9309abdabb0770479912a1e9
5
5
  SHA512:
6
- metadata.gz: 88804ec3406328978c34cb02e33ec8e62d7ab7c0459b099d60d13c38357675edad2f2442690902d100d827d836752109b23e66b67327dd0563018d45bdbfdabd
7
- data.tar.gz: d46d7d7848cf6aecff2f7470c597f0b10d4e5d71adb70c281088a0a6f4c3ef5d063fb0fbe88f51d2602418e5500b6f16e91ab7577809868e9011f52136a5a1b9
6
+ metadata.gz: 68dcf265bc0e451852768cda9d1007f9155707c4a1839d6a90cc15b4c66438c14bfd3baa80085607ee8fd01bf1413c55afe331d481b49b5565de310214982f51
7
+ data.tar.gz: bf9290204b050458c14d44950fc6022ff91ae363e55e11ebbbe404dea0ae867a6196f76ae0454c1827494bb981cf2f3a11dacf7344d7ec46210905bb94fba701
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p353
1
+ 2.6.2
data/CHANGELOG.md CHANGED
@@ -1,8 +1,40 @@
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
+
1
33
  ## 0.0.4 (August 24, 2014)
2
34
 
3
35
  This release adds notification of time and duration of rsyncs.
4
36
 
5
- It also adds the config.gatling.time_format configuration option to allow customization of the time format string when
37
+ It also adds the `config.gatling.time_format` configuration option to allow customization of the time format string when
6
38
  time information is printed to the console.
7
39
 
8
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
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.6.3'
7
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v2.2.16'
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
@@ -39,6 +39,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
39
39
  config.gatling.latency = 2.5
40
40
  config.gatling.time_format = "%H:%M:%S"
41
41
  end
42
+
43
+ # Automatically sync when machines with rsync folders come up.
44
+ config.gatling.rsync_on_startup = true
42
45
  end
43
46
  ```
44
47
 
@@ -49,6 +52,11 @@ command to sync files.
49
52
  vagrant gatling-rsync-auto
50
53
  ```
51
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
+
52
60
  ## Why "gatling"?
53
61
 
54
62
  The gatling gun was the first gun capable of firing continuously.
@@ -5,7 +5,7 @@
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
10
  config.vm.provider "docker" do |d, override|
11
11
  d.image = "smerrill/vagrant-centos"
@@ -13,22 +13,34 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
13
13
 
14
14
  # This is needed if you have non-Docker provisioners in the Vagrantfile.
15
15
  override.vm.box = nil
16
+ end
16
17
 
17
- # Ensure Vagrant knows the SSH port. See
18
- # https://github.com/mitchellh/vagrant/issues/3772.
19
- override.ssh.port = 22
18
+ config.vm.provider "lxc" do |d, override|
19
+ override.vm.box = "smerrill/centos-7"
20
20
  end
21
21
 
22
- # Share an additional folder to the guest VM. The first argument is
23
- # the path on the host to the actual folder. The second argument is
24
- # the path on the guest to mount the folder. And the optional third
25
- # argument is a set of non-required options.
26
- config.vm.synced_folder "../files", "/opt/vagrant/rsynced_folder", type: "rsync",
27
- rsync__exclude: [".git/", ".idea/"]
22
+ # When using gatling rsync in your projects, you should wrap these configs in
23
+ # an 'if Vagrant.has_plugin?("vagrant-gatling-rsync")' test.
28
24
 
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.
25
+ # Configure the window for gatling to coalesce writes.
32
26
  config.gatling.latency = 0.4
33
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|
45
+ end
34
46
  end
@@ -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
@@ -8,7 +8,7 @@ module VagrantPlugins
8
8
  class GatlingRsyncAuto < Vagrant.plugin(2, :command)
9
9
  # This is a sanity check to make sure no one is attempting to install
10
10
  # this into an early Vagrant version.
11
- if Vagrant::VERSION < "1.5.1"
11
+ if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new("1.5.1")
12
12
  raise Errors::Vagrant15RequiredError
13
13
  end
14
14
 
@@ -41,6 +41,16 @@ module VagrantPlugins
41
41
  folders = synced_folders(machine)[:rsync]
42
42
  next if !folders || folders.empty?
43
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
+
44
54
  folders.each do |id, folder_opts|
45
55
  # If we marked this folder to not auto sync, then
46
56
  # don't do it.
@@ -57,7 +67,11 @@ module VagrantPlugins
57
67
 
58
68
  if folder_opts[:exclude]
59
69
  Array(folder_opts[:exclude]).each do |pattern|
60
- ignores << VagrantPlugins::SyncedFolderRSync::RsyncHelper.exclude_to_regexp(hostpath, pattern.to_s)
70
+ if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new("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
61
75
  end
62
76
  end
63
77
  end
@@ -84,9 +98,11 @@ module VagrantPlugins
84
98
  ListenOSX.new(paths, ignores, latency, @logger, self.method(:callback)).run
85
99
  when /linux/
86
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
87
103
  else
88
104
  # @TODO: Raise this earlier?
89
- raise Errors::OnlyOSXLinuxSupportError
105
+ raise Errors::OSNotSupportedError
90
106
  end
91
107
 
92
108
  0
@@ -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 = true
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.
@@ -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
 
@@ -18,6 +18,12 @@ module VagrantPlugins
18
18
  I18n.reload!
19
19
  end
20
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
+
21
27
  command "gatling-rsync-auto" do
22
28
  setup_i18n
23
29
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GatlingRsync
3
- VERSION = "0.0.4"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -2,9 +2,11 @@ en:
2
2
  vagrant_gatling_rsync:
3
3
  gatling_ran: |-
4
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.
5
7
  errors:
6
- only_osx_linux_support: |-
7
- The vagrant-gatling-rsync 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.
8
10
  vagrant_15_required: |-
9
11
  The vagrant-gatling-rsync plugin requires Vagrant 1.5.1 or newer to function.
10
12
 
@@ -18,9 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
21
  spec.add_development_dependency "rake"
23
22
  spec.add_development_dependency "pry"
24
- # Make Vagrant work on Linux for development.
25
- spec.add_development_dependency "json", "~> 1.8.1"
26
23
  end
metadata CHANGED
@@ -1,71 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-gatling-rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.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: 2014-08-24 00:00:00.000000000 Z
11
+ date: 2021-05-31 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
- - !ruby/object:Gem::Dependency
56
- name: json
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 1.8.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: 1.8.1
69
41
  description: The gatling-rsync plugin runs on Mac and Linux and is far less CPU-intensive
70
42
  than the built-in rsync-auto.
71
43
  email:
@@ -74,8 +46,8 @@ executables: []
74
46
  extensions: []
75
47
  extra_rdoc_files: []
76
48
  files:
77
- - .gitignore
78
- - .ruby-version
49
+ - ".gitignore"
50
+ - ".ruby-version"
79
51
  - CHANGELOG.md
80
52
  - Gemfile
81
53
  - LICENSE
@@ -83,6 +55,7 @@ files:
83
55
  - Rakefile
84
56
  - example/vagrant/Vagrantfile
85
57
  - lib/vagrant-gatling-rsync.rb
58
+ - lib/vagrant-gatling-rsync/action/startup_rsync.rb
86
59
  - lib/vagrant-gatling-rsync/command/rsync_auto.rb
87
60
  - lib/vagrant-gatling-rsync/config.rb
88
61
  - lib/vagrant-gatling-rsync/errors.rb
@@ -103,17 +76,16 @@ require_paths:
103
76
  - lib
104
77
  required_ruby_version: !ruby/object:Gem::Requirement
105
78
  requirements:
106
- - - '>='
79
+ - - ">="
107
80
  - !ruby/object:Gem::Version
108
81
  version: '0'
109
82
  required_rubygems_version: !ruby/object:Gem::Requirement
110
83
  requirements:
111
- - - '>='
84
+ - - ">="
112
85
  - !ruby/object:Gem::Version
113
86
  version: '0'
114
87
  requirements: []
115
- rubyforge_project:
116
- rubygems_version: 2.1.11
88
+ rubygems_version: 3.1.2
117
89
  signing_key:
118
90
  specification_version: 4
119
91
  summary: A lighter-weight Vagrant plugin for watching and rsyncing directories.