ridley 1.6.0 → 1.7.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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216f146a9f80f6c69560dd58c6c8f79a0ccc3a8b
|
4
|
+
data.tar.gz: 66c4fed1770ed8d1c2f7493c01280cc01e2f15fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec951c99b32ff1588fdc1609f2a1e0bb594f091b0b3bd90757c728ded0a35e154860e66f29ed57c683426c3d188cda1efb963f2e3ab6a31f97ad206382c6b4e
|
7
|
+
data.tar.gz: 18d53a050989ae16eae0b8aa6d99c3bc4740b01bffd082bb46cecea04eea05e9e70955c6ee7c34c2d54b8a170ac0c1711f485667cfa294db91ddd3d5f68654a0
|
@@ -54,5 +54,51 @@ module Ridley
|
|
54
54
|
attr_hash = Hashie::Mash.from_dotted_path(key, value)
|
55
55
|
self.override_attributes = self.override_attributes.deep_merge(attr_hash)
|
56
56
|
end
|
57
|
+
|
58
|
+
# Removes a environment default attribute given its dotted path
|
59
|
+
# representation. Returns the default attributes of the environment.
|
60
|
+
#
|
61
|
+
# @param [String] key
|
62
|
+
# the dotted path to an attribute
|
63
|
+
#
|
64
|
+
# @return [Hashie::Mash]
|
65
|
+
def delete_default_attribute(key)
|
66
|
+
delete_attribute(key, :default)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Removes a environment override attribute given its dotted path
|
70
|
+
# representation. Returns the override attributes of the environment.
|
71
|
+
#
|
72
|
+
# @param [String] key
|
73
|
+
# the dotted path to an attribute
|
74
|
+
#
|
75
|
+
# @return [Hashie::Mash]
|
76
|
+
def delete_override_attribute(key)
|
77
|
+
delete_attribute(key, :override)
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
# Deletes an attribute at the given precedence using its dotted-path key.
|
83
|
+
#
|
84
|
+
# @param [String] key
|
85
|
+
# the dotted path to an attribute
|
86
|
+
# @param [Symbol] precedence
|
87
|
+
# the precedence level to delete the attribute from
|
88
|
+
#
|
89
|
+
# @return [Hashie::Mash]
|
90
|
+
def delete_attribute(key, precedence)
|
91
|
+
dotted_path = key.split('.')
|
92
|
+
leaf_key = dotted_path.pop
|
93
|
+
case precedence
|
94
|
+
when :default
|
95
|
+
attributes_to_change = self.default_attributes
|
96
|
+
when :override
|
97
|
+
attributes_to_change = self.override_attributes
|
98
|
+
end
|
99
|
+
leaf_hash = dotted_path.inject(attributes_to_change) { |hash, element| hash[element] }
|
100
|
+
leaf_hash.delete(leaf_key) unless leaf_hash.nil?
|
101
|
+
attributes_to_change
|
102
|
+
end
|
57
103
|
end
|
58
104
|
end
|
@@ -210,7 +210,7 @@ module Ridley
|
|
210
210
|
# @return [Boolean]
|
211
211
|
def connector_port_open?(host, port, wait_time = nil)
|
212
212
|
defer {
|
213
|
-
timeout(wait_time || PORT_CHECK_TIMEOUT) { Celluloid::IO::TCPSocket.new(host, port).close; true }
|
213
|
+
Timeout.timeout(wait_time || PORT_CHECK_TIMEOUT) { Celluloid::IO::TCPSocket.new(host, port).close; true }
|
214
214
|
}
|
215
215
|
rescue Errno::ETIMEDOUT, Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL => ex
|
216
216
|
false
|
data/lib/ridley/version.rb
CHANGED
@@ -53,5 +53,51 @@ describe Ridley::EnvironmentObject do
|
|
53
53
|
subject.default_attributes["deep"]["nested"]["item"].should be_true
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
describe "#delete_default_attribute" do
|
58
|
+
let(:delete_default_attribute) { subject.delete_default_attribute(attribute_key) }
|
59
|
+
let(:attribute_key) { "hello.world" }
|
60
|
+
|
61
|
+
before do
|
62
|
+
subject.set_default_attribute(attribute_key, true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "removes the default attribute" do
|
66
|
+
delete_default_attribute
|
67
|
+
expect(subject.default_attributes[:hello][:world]).to be_nil
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when the attribute does not exist" do
|
71
|
+
let(:delete_default_attribute) { subject.delete_default_attribute("not.existing") }
|
72
|
+
|
73
|
+
it "does not delete anything" do
|
74
|
+
delete_default_attribute
|
75
|
+
expect(subject.default_attributes[:hello][:world]).to be_true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#delete_override_attribute" do
|
81
|
+
let(:delete_override_attribute) { subject.delete_override_attribute(attribute_key) }
|
82
|
+
let(:attribute_key) { "hello.world" }
|
83
|
+
|
84
|
+
before do
|
85
|
+
subject.set_override_attribute(attribute_key, true)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "removes the override attribute" do
|
89
|
+
delete_override_attribute
|
90
|
+
expect(subject.override_attributes[:hello][:world]).to be_nil
|
91
|
+
end
|
92
|
+
|
93
|
+
context "when the attribute does not exist" do
|
94
|
+
let(:delete_override_attribute) { subject.delete_override_attribute("not.existing") }
|
95
|
+
|
96
|
+
it "does not delete anything" do
|
97
|
+
delete_override_attribute
|
98
|
+
expect(subject.override_attributes[:hello][:world]).to be_true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
56
102
|
end
|
57
103
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -452,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
452
452
|
version: '0'
|
453
453
|
requirements: []
|
454
454
|
rubyforge_project:
|
455
|
-
rubygems_version: 2.0.
|
455
|
+
rubygems_version: 2.0.3
|
456
456
|
signing_key:
|
457
457
|
specification_version: 4
|
458
458
|
summary: A reliable Chef API client with a clean syntax
|