vagrant-hosts 2.8.1 → 2.8.2

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
2
  SHA1:
3
- metadata.gz: b3e9f58247879332b3031dceff8009a6e305642a
4
- data.tar.gz: fdc56fdde18bceb36882a38c6a2511c238399806
3
+ metadata.gz: dcb44f6bea01ff90f2b53ea6f4e70a185eb1d9e7
4
+ data.tar.gz: 89e47f7c063126ed95a1428d5c9a731af03577aa
5
5
  SHA512:
6
- metadata.gz: 7ed4b370ea69eb8192194357ccfd5dd2d8ff62faf8fa8e1683c53ba15aabfa4870d77d7635c36b110b728810318b6ebc8e248404153b9ade8b6684c8c063fbc0
7
- data.tar.gz: 2250d47993c1bb57f64b6b8427a22b5e231835f8167454fc0c0b753f9f03c7c898257155b7d91622222c9010061e20bae35968f75ba03201f9f18c10ede06c28
6
+ metadata.gz: b5f02bcd8e452c89d4e5b8a8e191336bce48f1c9ed32b4d429fc7bd2313d67b9e4429650c4a9179f80fdc47bcaf672f8c4cff17d6dc4f868fb5f0acf5a7b3b82
7
+ data.tar.gz: def43babfd82b53a2080f26577a0ece85d42260eff2dba04ebc7b1e2f4e1b53c60a1f22b7f7ce6e81c7fe824dc45119c5043027462ccd72909831f23473b5207
@@ -28,5 +28,7 @@ matrix:
28
28
  env: TEST_VAGRANT_VERSION=v1.9.8 BUNDLER_VERSION=1.16.1
29
29
  - rvm: 2.4.4
30
30
  env: TEST_VAGRANT_VERSION=v2.0.4 BUNDLER_VERSION=1.16.1
31
+ - rvm: 2.4.4
32
+ env: TEST_VAGRANT_VERSION=v2.1.1 BUNDLER_VERSION=1.16.1
31
33
  - rvm: 2.4.4
32
34
  env: TEST_VAGRANT_VERSION=HEAD BUNDLER_VERSION=1.16.1
data/CHANGELOG CHANGED
@@ -1,6 +1,20 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 2.8.2
5
+ -----
6
+
7
+ 2018-06-05
8
+
9
+ This is a backwards compatible bugfix release.
10
+
11
+ * The `exports` and `imports` attributes of the hosts provisioner now
12
+ properly merge when a provisioner with the same name is definied in
13
+ multiple scopes (e.g. global, per-vm, per-provider).
14
+
15
+ * Added test coverage for Vagrant 2.1.
16
+
17
+
4
18
  2.8.1
5
19
  -----
6
20
 
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
  require 'rubygems/version'
3
3
 
4
- vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.0.4'
4
+ vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.1.1'
5
5
  vagrant_version = nil
6
6
 
7
7
  # Wrapping gemspec in the :plugins group causes Vagrant 1.5 and newer to
@@ -87,7 +87,19 @@ module VagrantHosts
87
87
  # @return [VagrantHosts::Config] The merged results
88
88
  def merge(other)
89
89
  result = super
90
- result.instance_variable_set(:@hosts, self.hosts.dup + other.hosts.dup)
90
+
91
+ new_hosts = (self.hosts.dup + other.hosts.dup).uniq
92
+ result.instance_variable_set(:@hosts, new_hosts.to_a)
93
+
94
+ result.imports = (self.imports.dup + other.imports.dup).uniq
95
+
96
+ result.exports = {}
97
+ [self.exports, other.exports].each do |hash|
98
+ hash.each do |k, v|
99
+ result.exports[k] ||= []
100
+ result.exports[k] += v.dup
101
+ end
102
+ end
91
103
 
92
104
  result
93
105
  end
@@ -20,6 +20,20 @@ module VagrantHosts
20
20
  # @!attribute [rw] exports
21
21
  def_model_attribute :imports
22
22
 
23
+ # @private
24
+ def configure_exports(config, val)
25
+ val.each do |k, v|
26
+ config.exports[k] ||= []
27
+ config.exports[k] += v
28
+ end
29
+ end
30
+
31
+ # @private
32
+ def configure_imports(config, val)
33
+ config.imports += val
34
+ config.imports.uniq!
35
+ end
36
+
23
37
  # @private
24
38
  def configure_hosts(config, val)
25
39
  val.each do |(address, aliases)|
@@ -1,3 +1,3 @@
1
1
  module VagrantHosts
2
- VERSION = '2.8.1'.freeze
2
+ VERSION = '2.8.2'.freeze
3
3
  end
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
3
  # Disable Vagrant autoloading so that other plugins defined in the Gemfile for
4
4
  # Acceptance tests are not loaded.
@@ -24,20 +24,50 @@ describe VagrantHosts::Config do
24
24
  expect(errors['Vagrant Hosts']).to eq []
25
25
  end
26
26
 
27
- it 'can be merged' do
28
- subject.add_host '127.0.0.1', ['local.server']
29
- subject.finalize!
27
+ context 'when merging' do
28
+ let(:other) { described_class.new }
30
29
 
31
- other = described_class.new
32
- other.add_host '10.0.20.1', ['other.server']
33
- other.finalize!
30
+ it 'combines hosts arrays' do
31
+ subject.add_host '127.0.0.1', ['local.server']
32
+ subject.finalize!
34
33
 
35
- result = subject.merge(other)
34
+ other.add_host '127.0.0.1', ['some-alias']
35
+ other.add_host '10.0.20.1', ['other.server']
36
+ other.finalize!
36
37
 
37
- expect(result.hosts).to eq [
38
- ["127.0.0.1", ["local.server"]],
39
- ["10.0.20.1", ["other.server"]]]
40
- end
38
+ result = subject.merge(other)
39
+
40
+ expect(result.hosts).to eq [['127.0.0.1', ['local.server']],
41
+ ['127.0.0.1', ['some-alias']],
42
+ ['10.0.20.1', ['other.server']]]
43
+ end
44
+
45
+ it 'combines import arrays' do
46
+ subject.imports = ['foo', 'baz']
47
+ subject.finalize!
48
+
49
+ other.imports = ['foo', 'bar']
50
+ other.finalize!
41
51
 
52
+ result = subject.merge(other)
53
+
54
+ expect(result.imports).to eq ['foo', 'baz', 'bar']
55
+ end
56
+
57
+ it 'merges export hashes' do
58
+ subject.exports = {global: [["127.0.0.1", ["local.server"]]]}
59
+ subject.finalize!
60
+
61
+ other.exports = {global: [["127.0.0.1", ["test.server"]]],
62
+ some_provider: [["127.0.0.1", ["some-alias"]]]}
63
+ other.finalize!
64
+
65
+ result = subject.merge(other)
66
+
67
+ expect(result.exports).to eq({global: [['127.0.0.1', ['local.server']],
68
+ ['127.0.0.1', ['test.server']]],
69
+ some_provider: [["127.0.0.1", ["some-alias"]]]})
70
+ end
71
+ end
42
72
  end
43
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-02 00:00:00.000000000 Z
12
+ date: 2018-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake