configru 2.0.0 → 2.0.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/ChangeLog.md +8 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +11 -11
- data/README.md +35 -4
- data/lib/configru/version.rb +1 -1
- data/lib/configru.rb +4 -1
- data/spec/configru_spec.rb +10 -0
- data/spec/example_files/example_g.yml +2 -0
- data/spec/example_files/example_h.yml +1 -0
- metadata +9 -5
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
configru (2.0.
|
4
|
+
configru (2.0.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -9,14 +9,14 @@ GEM
|
|
9
9
|
diff-lcs (1.1.3)
|
10
10
|
multi_json (1.3.6)
|
11
11
|
rake (0.9.2.2)
|
12
|
-
rspec (2.
|
13
|
-
rspec-core (~> 2.
|
14
|
-
rspec-expectations (~> 2.
|
15
|
-
rspec-mocks (~> 2.
|
16
|
-
rspec-core (2.
|
17
|
-
rspec-expectations (2.
|
18
|
-
diff-lcs (~> 1.1.
|
19
|
-
rspec-mocks (2.
|
12
|
+
rspec (2.10.0)
|
13
|
+
rspec-core (~> 2.10.0)
|
14
|
+
rspec-expectations (~> 2.10.0)
|
15
|
+
rspec-mocks (~> 2.10.0)
|
16
|
+
rspec-core (2.10.1)
|
17
|
+
rspec-expectations (2.10.0)
|
18
|
+
diff-lcs (~> 1.1.3)
|
19
|
+
rspec-mocks (2.10.1)
|
20
20
|
simplecov (0.6.4)
|
21
21
|
multi_json (~> 1.0)
|
22
22
|
simplecov-html (~> 0.5.3)
|
@@ -27,6 +27,6 @@ PLATFORMS
|
|
27
27
|
|
28
28
|
DEPENDENCIES
|
29
29
|
configru!
|
30
|
-
rake
|
31
|
-
rspec (~> 2.
|
30
|
+
rake (~> 0.9.0)
|
31
|
+
rspec (~> 2.10.0)
|
32
32
|
simplecov (~> 0.6.0)
|
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
# Configru
|
2
|
-
|
3
|
-
[](http://travis-ci.org/programble/configru)
|
1
|
+
# Configru [](http://travis-ci.org/programble/configru) [](https://gemnasium.com/programble/configru)
|
4
2
|
|
5
3
|
YAML configuration file loader
|
6
4
|
|
@@ -8,7 +6,40 @@ YAML configuration file loader
|
|
8
6
|
|
9
7
|
```ruby
|
10
8
|
# Gemfile
|
11
|
-
gem
|
9
|
+
gem "configru", "~> 2.0.0"
|
10
|
+
```
|
11
|
+
### Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'configru'
|
15
|
+
|
16
|
+
Configru.load('config.yml') do
|
17
|
+
option :username, String, 'example_user'
|
18
|
+
option :token, Fixnum, 1234
|
19
|
+
option_group :connection do
|
20
|
+
option :server, String, 'example.com'
|
21
|
+
option :port, Fixnum, 42
|
22
|
+
end
|
23
|
+
option :path, String, Dir.home do
|
24
|
+
transform {|x| File.expand_path(x) }
|
25
|
+
validate {|x| File.directory?(x) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
example = Example.new(Configru.connection.server, Configru.connection.port)
|
30
|
+
example.login(Configru.username, Configru.token)
|
31
|
+
example.sync(Configru.path)
|
32
|
+
```
|
33
|
+
|
34
|
+
These defaults are equivalent to the following YAML:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
username: example_user
|
38
|
+
token: 1234
|
39
|
+
connection:
|
40
|
+
server: example.com
|
41
|
+
port: 42
|
42
|
+
path: ~
|
12
43
|
```
|
13
44
|
|
14
45
|
# License
|
data/lib/configru/version.rb
CHANGED
data/lib/configru.rb
CHANGED
data/spec/configru_spec.rb
CHANGED
@@ -59,6 +59,16 @@ describe Configru do
|
|
59
59
|
Configru.example.should == 'example_b'
|
60
60
|
end
|
61
61
|
|
62
|
+
it 'cascades loaded files' do
|
63
|
+
Configru.load(example_file(:g), example_file(:h)) do
|
64
|
+
option :option1
|
65
|
+
option :option2
|
66
|
+
end
|
67
|
+
|
68
|
+
Configru.option1.should == 'example_g'
|
69
|
+
Configru.option2.should == 'example_h'
|
70
|
+
end
|
71
|
+
|
62
72
|
it 'loads a file with a group' do
|
63
73
|
Configru.load(example_file :c) do
|
64
74
|
option_group :example_group do
|
@@ -0,0 +1 @@
|
|
1
|
+
option2: example_h
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
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: 2012-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: YAML configuration file loader
|
15
15
|
email:
|
@@ -40,6 +40,8 @@ files:
|
|
40
40
|
- spec/example_files/example_d.yml
|
41
41
|
- spec/example_files/example_e.yml
|
42
42
|
- spec/example_files/example_f.yml
|
43
|
+
- spec/example_files/example_g.yml
|
44
|
+
- spec/example_files/example_h.yml
|
43
45
|
- spec/spec_helper.rb
|
44
46
|
- spec/structhash_spec.rb
|
45
47
|
homepage: https://github.com/programble/configru
|
@@ -56,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
58
|
version: '0'
|
57
59
|
segments:
|
58
60
|
- 0
|
59
|
-
hash:
|
61
|
+
hash: 872203077689334122
|
60
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
63
|
none: false
|
62
64
|
requirements:
|
@@ -65,10 +67,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
67
|
version: '0'
|
66
68
|
segments:
|
67
69
|
- 0
|
68
|
-
hash:
|
70
|
+
hash: 872203077689334122
|
69
71
|
requirements: []
|
70
72
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
73
|
+
rubygems_version: 1.8.24
|
72
74
|
signing_key:
|
73
75
|
specification_version: 3
|
74
76
|
summary: YAML configuration file loader
|
@@ -81,5 +83,7 @@ test_files:
|
|
81
83
|
- spec/example_files/example_d.yml
|
82
84
|
- spec/example_files/example_e.yml
|
83
85
|
- spec/example_files/example_f.yml
|
86
|
+
- spec/example_files/example_g.yml
|
87
|
+
- spec/example_files/example_h.yml
|
84
88
|
- spec/spec_helper.rb
|
85
89
|
- spec/structhash_spec.rb
|