vault-tools 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vault-tools/config.rb +2 -1
- data/lib/vault-tools/version.rb +1 -1
- data/test/defaults_test.rb +16 -0
- metadata +3 -3
data/lib/vault-tools/config.rb
CHANGED
@@ -55,7 +55,8 @@ module Vault
|
|
55
55
|
# @return [String] The value of the ENV value or default.
|
56
56
|
def self.[](name)
|
57
57
|
var_name = name.to_s.upcase
|
58
|
-
|
58
|
+
default_name = name.to_s.downcase.to_sym
|
59
|
+
ENV[var_name] || @@defaults[default_name]
|
59
60
|
end
|
60
61
|
|
61
62
|
# An environment variable.
|
data/lib/vault-tools/version.rb
CHANGED
data/test/defaults_test.rb
CHANGED
@@ -44,4 +44,20 @@ class DefaultsTest < Vault::TestCase
|
|
44
44
|
assert_equal('1,2', Config[:array])
|
45
45
|
assert_equal(['1','2'], Config.array(:array))
|
46
46
|
end
|
47
|
+
|
48
|
+
def test_default_with_app_deploy
|
49
|
+
assert_raises RuntimeError do
|
50
|
+
Config.app_deploy
|
51
|
+
end
|
52
|
+
Config.default(:app_deploy, 'test')
|
53
|
+
assert_equal('test', Config.app_deploy)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_default_with_app_name
|
57
|
+
assert_raises RuntimeError do
|
58
|
+
Config.app_name
|
59
|
+
end
|
60
|
+
Config.default(:app_name, 'vault-rulez')
|
61
|
+
assert_equal('vault-rulez', Config.app_name)
|
62
|
+
end
|
47
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -182,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
segments:
|
184
184
|
- 0
|
185
|
-
hash:
|
185
|
+
hash: -1307566014152102806
|
186
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
187
|
none: false
|
188
188
|
requirements:
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
segments:
|
193
193
|
- 0
|
194
|
-
hash:
|
194
|
+
hash: -1307566014152102806
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
197
|
rubygems_version: 1.8.23
|