simple-conf 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/config/settings.yml +3 -0
- data/lib/simple-conf/loader.rb +4 -0
- data/lib/simple-conf/version.rb +1 -1
- data/spec/simple_conf_spec.rb +14 -0
- metadata +10 -3
data/config/settings.yml
ADDED
data/lib/simple-conf/loader.rb
CHANGED
@@ -18,6 +18,10 @@ module SimpleConf
|
|
18
18
|
yaml_file.fetch(Rails.env, {}).each_pair do |key, value|
|
19
19
|
set(key, value)
|
20
20
|
end if rails_environment_defined?
|
21
|
+
|
22
|
+
yaml_file.fetch(@klass.env, {}).each_pair do |key, value|
|
23
|
+
set(key, value)
|
24
|
+
end if @klass.respond_to?(:env)
|
21
25
|
end
|
22
26
|
|
23
27
|
def path
|
data/lib/simple-conf/version.rb
CHANGED
data/spec/simple_conf_spec.rb
CHANGED
@@ -20,6 +20,14 @@ module ConfigModule
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
class Settings
|
24
|
+
def self.env
|
25
|
+
'test'
|
26
|
+
end
|
27
|
+
|
28
|
+
include SimpleConf
|
29
|
+
end
|
30
|
+
|
23
31
|
describe SimpleConf do
|
24
32
|
context "on include to config class generate properties" do
|
25
33
|
it { Configuration.staging.domain.should == "staging.example.com" }
|
@@ -45,6 +53,12 @@ describe SimpleConf do
|
|
45
53
|
end
|
46
54
|
end
|
47
55
|
|
56
|
+
describe SimpleConf do
|
57
|
+
context 'on include properties depenending on env method' do
|
58
|
+
Settings.domain.should == 'test.example.com'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
48
62
|
class TestObject ; end
|
49
63
|
|
50
64
|
describe SimpleConf do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- Rakefile
|
46
46
|
- config/configuration.yml
|
47
47
|
- config/options.yml
|
48
|
+
- config/settings.yml
|
48
49
|
- lib/simple-conf.rb
|
49
50
|
- lib/simple-conf/loader.rb
|
50
51
|
- lib/simple-conf/version.rb
|
@@ -63,15 +64,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
64
|
- - ! '>='
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: '0'
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
hash: -3270257596894205233
|
66
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
71
|
none: false
|
68
72
|
requirements:
|
69
73
|
- - ! '>='
|
70
74
|
- !ruby/object:Gem::Version
|
71
75
|
version: '0'
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: -3270257596894205233
|
72
79
|
requirements: []
|
73
80
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.8.
|
81
|
+
rubygems_version: 1.8.25
|
75
82
|
signing_key:
|
76
83
|
specification_version: 3
|
77
84
|
summary: Simple configuration library for yml files for loading from the config folder
|