konfigurator 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/konfigurator.gemspec +2 -2
- data/lib/konfigurator/simple.rb +6 -2
- data/test/test_simple.rb +9 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/konfigurator.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{konfigurator}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kriss 'nu7hatch' Kowalik"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-29}
|
13
13
|
s.description = %q{ Konfigurator is a small and flexible configuration toolkit, which allow you
|
14
14
|
to configure your apps, classes or modules with DSL-style or Sinatra-like settings.
|
15
15
|
}
|
data/lib/konfigurator/simple.rb
CHANGED
@@ -85,9 +85,13 @@ module Konfigurator
|
|
85
85
|
# bar: true
|
86
86
|
# production:
|
87
87
|
# bla: foobar
|
88
|
-
def load_settings(fname)
|
88
|
+
def load_settings(fname, use_envs=true)
|
89
89
|
conf = YAML.load_file(fname)
|
90
|
-
|
90
|
+
if use_envs
|
91
|
+
conf[env.to_s].each {|k,v| set k.to_sym, v }
|
92
|
+
else
|
93
|
+
conf.each {|k,v| set k.to_sym, v }
|
94
|
+
end
|
91
95
|
end
|
92
96
|
end # ClassMethods
|
93
97
|
end # Simple
|
data/test/test_simple.rb
CHANGED
@@ -59,6 +59,15 @@ class TestSimple < Test::Unit::TestCase
|
|
59
59
|
assert_equal "bar", subject.foo
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
should "not use envs when use_envs is false" do
|
64
|
+
with_conf_file do |fname|
|
65
|
+
subject.set :environment, :production
|
66
|
+
subject.load_settings(fname, false)
|
67
|
+
assert subject.production
|
68
|
+
assert_equal "bar", subject.production['foo']
|
69
|
+
end
|
70
|
+
end
|
62
71
|
end
|
63
72
|
|
64
73
|
describe "Object configured with Konfigurator::Simple" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konfigurator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kriss 'nu7hatch' Kowalik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-29 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|