configru 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.2.0 (25 May 2013)
4
+
5
+ * Validate values against arrays using `include?`
6
+
3
7
  ## 3.1.0 (28 October 2012)
4
8
 
5
9
  * Added required options
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  source :rubygems
2
2
 
3
3
  group :development do
4
- gem "rake", "~> 0.9.0"
5
- gem "rspec", "~> 2.11.0"
4
+ gem "rake", "~> 10.0.0"
5
+ gem "rspec", "~> 2.12.0"
6
6
  gem "simplecov", "~> 0.7.0"
7
7
  end
8
8
 
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- configru (3.1.0)
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.9.2.2)
12
- rspec (2.11.0)
13
- rspec-core (~> 2.11.0)
14
- rspec-expectations (~> 2.11.0)
15
- rspec-mocks (~> 2.11.0)
16
- rspec-core (2.11.1)
17
- rspec-expectations (2.11.3)
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.11.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.9.0)
31
- rspec (~> 2.11.0)
30
+ rake (~> 10.0.0)
31
+ rspec (~> 2.12.0)
32
32
  simplecov (~> 0.7.0)
data/README.md CHANGED
@@ -6,7 +6,7 @@ YAML configuration file loader
6
6
 
7
7
  ```ruby
8
8
  # Gemfile
9
- gem "configru", "~> 2.0.0"
9
+ gem "configru", "~> 3.1.0"
10
10
  ```
11
11
  ### Example
12
12
 
@@ -6,7 +6,11 @@ module Configru
6
6
 
7
7
  def valid?(value)
8
8
  return true unless self.validation
9
- self.validation === value
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
- # Use === instead of passing validation as the block to #all? so that
36
- # non-block validations (Regexp, Range) work
37
- self.validation === x
39
+ super(x)
38
40
  end
39
41
  end
40
42
 
@@ -1,3 +1,3 @@
1
1
  module Configru
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
@@ -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.1.0
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: 2012-10-28 00:00:00.000000000 Z
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: 1.8.24
66
+ rubygems_version: 2.0.0
75
67
  signing_key:
76
- specification_version: 3
68
+ specification_version: 4
77
69
  summary: YAML configuration file loader
78
70
  test_files:
79
71
  - spec/configru_spec.rb