rock_config 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rock_config.rb +4 -4
- data/lib/rock_config/manager.rb +2 -3
- data/lib/rock_config/scanner.rb +1 -1
- data/lib/rock_config/version.rb +1 -1
- data/spec/manager_spec.rb +3 -2
- data/spec/scanner_spec.rb +1 -1
- metadata +2 -2
data/lib/rock_config.rb
CHANGED
@@ -21,10 +21,10 @@ module RockConfig
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def detect_environment
|
24
|
-
@detected_environment ||=
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
@detected_environment ||= begin
|
25
|
+
detector = EnvironmentDetector.new(ENV)
|
26
|
+
detector.detect
|
27
|
+
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def configuration
|
data/lib/rock_config/manager.rb
CHANGED
@@ -10,8 +10,8 @@ module RockConfig
|
|
10
10
|
if config_for_environment = config[environment]
|
11
11
|
return config_for_environment
|
12
12
|
else
|
13
|
-
raise EnvironmentNotFoundError,
|
14
|
-
'Environment "%s" not found' % environment
|
13
|
+
raise EnvironmentNotFoundError,
|
14
|
+
'Environment "%s" not found for config file "%s"' % [environment, config_name]
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -23,6 +23,5 @@ module RockConfig
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
27
26
|
end
|
28
27
|
end
|
data/lib/rock_config/scanner.rb
CHANGED
data/lib/rock_config/version.rb
CHANGED
data/spec/manager_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module RockConfig
|
4
4
|
describe Manager do
|
5
|
-
let(:configuration) do
|
5
|
+
let(:configuration) do
|
6
6
|
configuration = Configuration.new
|
7
7
|
configuration.scanned_directories << File.join(Dir.pwd, "spec", "fixtures")
|
8
8
|
configuration.config_loaders << YamlLoader.new
|
@@ -22,7 +22,8 @@ module RockConfig
|
|
22
22
|
|
23
23
|
expect do
|
24
24
|
manager_result = manager.fetch "database", "me no exist yo"
|
25
|
-
end.to raise_error(EnvironmentNotFoundError
|
25
|
+
end.to raise_error(EnvironmentNotFoundError,
|
26
|
+
'Environment "me no exist yo" not found for config file "database"')
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/spec/scanner_spec.rb
CHANGED
@@ -15,7 +15,7 @@ module RockConfig
|
|
15
15
|
it "finds nothing when the target doesnt exist" do
|
16
16
|
expect do
|
17
17
|
scanner.find("database")
|
18
|
-
end.to raise_error(ConfigNotFoundError)
|
18
|
+
end.to raise_error(ConfigNotFoundError, 'Config file "database" not found')
|
19
19
|
end
|
20
20
|
|
21
21
|
it "scans additional directories" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|