bosh-verifyconnections 1.0.1 → 1.0.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: 820df08ec6e4f8bb911adf3b77010afeaa429a7f
4
- data.tar.gz: fa25cf1b90e232c949752801ff3c48f61763acc3
3
+ metadata.gz: 8f25f5d50e5ee314d28693c880349f5c4deaaef8
4
+ data.tar.gz: 71bef84a3153e2e46d7e769abddb6bbf0028b6ff
5
5
  SHA512:
6
- metadata.gz: 7a3bdfe381d651ef8df6a21234cde13ea895dcc7c1b425db01e82d6915d0a559a73dbd583d8106ecf45624ee427e348ec7fcfb2575f97105ce2195a62a5106f7
7
- data.tar.gz: c7e8be56bdf4e734b52651d41a388953d692b0925d9f1b32a669db97e4e33a7fe031049df27b97e30387acdcc4eeb68812b8af56118736971ec26089ce42c120
6
+ metadata.gz: 68cf9781479536c921fd33358508b445bc10302cbb5c658e82a6298f31a60d3b0ee895def00ef0370c62797c1a18942f9eee8d65896ee9b84a1bb142cad77858
7
+ data.tar.gz: 662baeee9ff26390bcc9796815a657c13dfecdbae52d328cf4512ed0ed930da055545ada4b5f242bd751519bdb5664771d840c05d0bdeb6fd4b565263f236408
data/ChangeLog.md CHANGED
@@ -3,3 +3,4 @@
3
3
  ## v1.0
4
4
 
5
5
  * Released May 3rd 2014
6
+ * Now tests properties that contain arrays of static_ips or hostnames [v1.0.2]
data/Guardfile CHANGED
@@ -4,5 +4,6 @@
4
4
  guard :rspec do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
6
  watch(%r{^lib/bosh/verifyconnections/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch(%r{^lib/core-ext/(.+)\.rb$}) { |m| "spec/core-ext/#{m[1]}_spec.rb" }
7
8
  watch('spec/spec_helper.rb') { "spec" }
8
9
  end
@@ -1,4 +1,4 @@
1
- require "core-ext/hash_to_dotted_notation"
1
+ require "core-ext/hash/to_dotted_hash"
2
2
 
3
3
  module Bosh::Cli::Command
4
4
  # Performs job interconnection verifications upon the target deployment
@@ -1,6 +1,6 @@
1
1
  require "common/deep_copy"
2
- require "core-ext/hash_deep_merge"
3
- require "core-ext/hash_to_dotted_notation"
2
+ require "core-ext/hash/deep_merge"
3
+ require "core-ext/hash/to_dotted_hash"
4
4
 
5
5
  module Bosh::VerifyConnections
6
6
  class Deployment
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module VerifyConnections
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -5,6 +5,16 @@ class Hash
5
5
  key = recursive_key + k.to_s
6
6
  if v.is_a? Hash
7
7
  ret.merge!(v.to_dotted_hash(key + "."))
8
+ elsif v.is_a?(Array)
9
+ if v.first.is_a?(Hash)
10
+ v.each_with_index do |item, index|
11
+ ret.merge!(item.to_dotted_hash(key + "[#{index}]."))
12
+ end
13
+ else
14
+ v.each_with_index do |item, index|
15
+ ret[key + "[#{index}]"] = item
16
+ end
17
+ end
8
18
  else
9
19
  ret[key] = v
10
20
  end
@@ -0,0 +1,12 @@
1
+ describe "Hash#to_dotted_hash" do
2
+ it { expect({}.to_dotted_hash).to eq({}) }
3
+ it { expect({"foo" => "bar"}.to_dotted_hash).to eq({"foo" => "bar"}) }
4
+ it { expect({foo: "bar"}.to_dotted_hash).to eq({"foo" => "bar"}) }
5
+ it { expect({foo: {bar: "baz"}}.to_dotted_hash).to eq({"foo.bar" => "baz"}) }
6
+
7
+ context "arrays" do
8
+ it { expect({foo: {bar: []}}.to_dotted_hash).to eq({}) }
9
+ it { expect({foo: {bar: ["a", "b"]}}.to_dotted_hash).to eq({"foo.bar[0]" => "a", "foo.bar[1]" => "b"}) }
10
+ it { expect({foo: [{bar: "baz"}, {alpha: 123}]}.to_dotted_hash).to eq({"foo[0].bar" => "baz", "foo[1].alpha" => 123}) }
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-verifyconnections
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -105,8 +105,9 @@ files:
105
105
  - lib/bosh/verifyconnections/models/deployment_job.rb
106
106
  - lib/bosh/verifyconnections/models/director.rb
107
107
  - lib/bosh/verifyconnections/version.rb
108
- - lib/core-ext/hash_deep_merge.rb
109
- - lib/core-ext/hash_to_dotted_notation.rb
108
+ - lib/core-ext/hash/deep_merge.rb
109
+ - lib/core-ext/hash/to_dotted_hash.rb
110
+ - spec/core-ext/hash/to_dotted_hash_spec.rb
110
111
  - spec/fixtures/combination_of_correct_dns_and_static_ip_connections.yml
111
112
  - spec/fixtures/job_with_static_ips_but_not_referenced.yml
112
113
  - spec/fixtures/property_is_bosh_dns_but_not_for_bosh_job.yml
@@ -140,6 +141,7 @@ specification_version: 4
140
141
  summary: Performs job interconnection verifications upon the target BOSH deployment
141
142
  manifest file.
142
143
  test_files:
144
+ - spec/core-ext/hash/to_dotted_hash_spec.rb
143
145
  - spec/fixtures/combination_of_correct_dns_and_static_ip_connections.yml
144
146
  - spec/fixtures/job_with_static_ips_but_not_referenced.yml
145
147
  - spec/fixtures/property_is_bosh_dns_but_not_for_bosh_job.yml