configru 3.1.0 → 3.2.0
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.
- checksums.yaml +7 -0
- data/ChangeLog.md +4 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +11 -11
- data/README.md +1 -1
- data/lib/configru/option.rb +6 -4
- data/lib/configru/version.rb +1 -1
- data/spec/configru_spec.rb +14 -0
- metadata +7 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0e43a0f04efab82159aa7a8bfce6965514e297f
|
4
|
+
data.tar.gz: 2c3ca705fca4c7ebe13dc08517c6d163ec8a30e5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ff4b868839bc60a86e4841873ff3f456e5f8db673982053ba217aa4f79712713d630fce62a7413b4a40a3dda95e3dc2a3c17ffb458d3bee9bd81c0bea5181af
|
7
|
+
data.tar.gz: e20b5336317db72005c6e15b34fe8f4bdf76ca488c522ff35ce0c40f5867ed2926e3e142bf37635fd0ac8d8b9fbeaa7230fe4aa5935ee5aa0a51ce35281d6ce9
|
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
configru (3.
|
4
|
+
configru (3.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
diff-lcs (1.1.3)
|
10
10
|
multi_json (1.3.6)
|
11
|
-
rake (0.
|
12
|
-
rspec (2.
|
13
|
-
rspec-core (~> 2.
|
14
|
-
rspec-expectations (~> 2.
|
15
|
-
rspec-mocks (~> 2.
|
16
|
-
rspec-core (2.
|
17
|
-
rspec-expectations (2.
|
11
|
+
rake (10.0.2)
|
12
|
+
rspec (2.12.0)
|
13
|
+
rspec-core (~> 2.12.0)
|
14
|
+
rspec-expectations (~> 2.12.0)
|
15
|
+
rspec-mocks (~> 2.12.0)
|
16
|
+
rspec-core (2.12.0)
|
17
|
+
rspec-expectations (2.12.0)
|
18
18
|
diff-lcs (~> 1.1.3)
|
19
|
-
rspec-mocks (2.
|
19
|
+
rspec-mocks (2.12.0)
|
20
20
|
simplecov (0.7.1)
|
21
21
|
multi_json (~> 1.0)
|
22
22
|
simplecov-html (~> 0.7.1)
|
@@ -27,6 +27,6 @@ PLATFORMS
|
|
27
27
|
|
28
28
|
DEPENDENCIES
|
29
29
|
configru!
|
30
|
-
rake (~> 0.
|
31
|
-
rspec (~> 2.
|
30
|
+
rake (~> 10.0.0)
|
31
|
+
rspec (~> 2.12.0)
|
32
32
|
simplecov (~> 0.7.0)
|
data/README.md
CHANGED
data/lib/configru/option.rb
CHANGED
@@ -6,7 +6,11 @@ module Configru
|
|
6
6
|
|
7
7
|
def valid?(value)
|
8
8
|
return true unless self.validation
|
9
|
-
self.validation
|
9
|
+
if self.validation.is_a? Array
|
10
|
+
self.validation.include? value
|
11
|
+
else
|
12
|
+
self.validation === value
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def transform(value)
|
@@ -32,9 +36,7 @@ module Configru
|
|
32
36
|
def valid?(values)
|
33
37
|
return true unless self.validation
|
34
38
|
values.all? do |x|
|
35
|
-
|
36
|
-
# non-block validations (Regexp, Range) work
|
37
|
-
self.validation === x
|
39
|
+
super(x)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
data/lib/configru/version.rb
CHANGED
data/spec/configru_spec.rb
CHANGED
@@ -116,6 +116,20 @@ describe Configru do
|
|
116
116
|
end.to raise_error(Configru::OptionValidationError)
|
117
117
|
end
|
118
118
|
|
119
|
+
it 'validates options against arrays' do
|
120
|
+
Configru.load(example_file :d) do
|
121
|
+
option :example, String, '', ['example_d']
|
122
|
+
end
|
123
|
+
|
124
|
+
Configru.example.should == 'example_d'
|
125
|
+
|
126
|
+
expect do
|
127
|
+
Configru.load(example_file :d) do
|
128
|
+
option :example, String, '', ['foo', 'bar']
|
129
|
+
end
|
130
|
+
end.to raise_error(Configru::OptionValidationError)
|
131
|
+
end
|
132
|
+
|
119
133
|
it 'applies transformations to options' do
|
120
134
|
Configru.load(example_file :d) do
|
121
135
|
option :example, String, '' do
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
5
|
-
prerelease:
|
4
|
+
version: 3.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Curtis McEnroe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-26 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: YAML configuration file loader
|
15
14
|
email:
|
@@ -47,33 +46,26 @@ files:
|
|
47
46
|
- spec/structhash_spec.rb
|
48
47
|
homepage: https://github.com/programble/configru
|
49
48
|
licenses: []
|
49
|
+
metadata: {}
|
50
50
|
post_install_message:
|
51
51
|
rdoc_options: []
|
52
52
|
require_paths:
|
53
53
|
- lib
|
54
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
55
|
requirements:
|
57
|
-
- -
|
56
|
+
- - '>='
|
58
57
|
- !ruby/object:Gem::Version
|
59
58
|
version: '0'
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
hash: -933194907027225468
|
63
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
60
|
requirements:
|
66
|
-
- -
|
61
|
+
- - '>='
|
67
62
|
- !ruby/object:Gem::Version
|
68
63
|
version: '0'
|
69
|
-
segments:
|
70
|
-
- 0
|
71
|
-
hash: -933194907027225468
|
72
64
|
requirements: []
|
73
65
|
rubyforge_project:
|
74
|
-
rubygems_version:
|
66
|
+
rubygems_version: 2.0.0
|
75
67
|
signing_key:
|
76
|
-
specification_version:
|
68
|
+
specification_version: 4
|
77
69
|
summary: YAML configuration file loader
|
78
70
|
test_files:
|
79
71
|
- spec/configru_spec.rb
|