configru 3.2.0 → 3.3.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 +4 -4
- data/ChangeLog.md +4 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +14 -14
- data/README.md +5 -3
- data/lib/configru/dsl.rb +4 -0
- data/lib/configru/version.rb +1 -1
- data/spec/dsl_spec.rb +13 -0
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae318028efd8fe15be837da4b7d380b37b56f45f
|
4
|
+
data.tar.gz: 999d480761041c6f44a84e9439e64ee787824fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37ecee87d6bb651b311c32c615a7f7c3ba33677dc8290c846884282d6e08402e2b24ed5bc24f25fca440e568ecf9b4d24a15244917d22f15ec1786c28df1a99
|
7
|
+
data.tar.gz: c7fe3787326ad36674a8db13af1f0b7739ee94175285a809884a17baef3e7613d2fa35726b2b887b0115ce1fe8192bbf2b887e4bb5c87952aa896a6266ceb3ff
|
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.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
|
-
remote:
|
7
|
+
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.
|
9
|
+
diff-lcs (1.2.4)
|
10
10
|
multi_json (1.3.6)
|
11
|
-
rake (10.0
|
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 (
|
19
|
-
rspec-mocks (2.
|
11
|
+
rake (10.1.0)
|
12
|
+
rspec (2.14.1)
|
13
|
+
rspec-core (~> 2.14.0)
|
14
|
+
rspec-expectations (~> 2.14.0)
|
15
|
+
rspec-mocks (~> 2.14.0)
|
16
|
+
rspec-core (2.14.5)
|
17
|
+
rspec-expectations (2.14.3)
|
18
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
19
|
+
rspec-mocks (2.14.3)
|
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 (~> 10.
|
31
|
-
rspec (~> 2.
|
30
|
+
rake (~> 10.1.0)
|
31
|
+
rspec (~> 2.14.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", "~> 3.
|
9
|
+
gem "configru", "~> 3.3.0"
|
10
10
|
```
|
11
11
|
### Example
|
12
12
|
|
@@ -25,12 +25,13 @@ Configru.load('config.yml') do
|
|
25
25
|
validate {|x| File.directory?(x) }
|
26
26
|
end
|
27
27
|
option_array :channels, String, ['foo', 'bar']
|
28
|
+
option_bool :force, false
|
28
29
|
end
|
29
30
|
|
30
31
|
example = Example.new(Configru.connection.server, Configru.connection.port)
|
31
32
|
example.login(Configru.username, Configru.token)
|
32
33
|
Configru.channels.each do |x|
|
33
|
-
example.sync(x, Configru.path)
|
34
|
+
example.sync(x, Configru.path, :force => Configru.force)
|
34
35
|
end
|
35
36
|
```
|
36
37
|
|
@@ -45,11 +46,12 @@ path: ~
|
|
45
46
|
channels:
|
46
47
|
- foo
|
47
48
|
- bar
|
49
|
+
force: false
|
48
50
|
```
|
49
51
|
|
50
52
|
# License
|
51
53
|
|
52
|
-
Copyright
|
54
|
+
Copyright © 2011-2013, Curtis McEnroe <programble@gmail.com>
|
53
55
|
|
54
56
|
Permission to use, copy, modify, and/or distribute this software for any
|
55
57
|
purpose with or without fee is hereby granted, provided that the above
|
data/lib/configru/dsl.rb
CHANGED
@@ -16,6 +16,10 @@ module Configru
|
|
16
16
|
@options[name.to_s] = option
|
17
17
|
end
|
18
18
|
|
19
|
+
def option_bool(name, default, &block)
|
20
|
+
option(name, Object, default, [true, false], &block)
|
21
|
+
end
|
22
|
+
|
19
23
|
def option_required(name, type = Object, validation = nil, &block)
|
20
24
|
option = Configru::RequiredOption.new(type, validation, nil)
|
21
25
|
RequiredOption.new(option, &block) if block
|
data/lib/configru/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -78,6 +78,19 @@ describe Configru::DSL::OptionGroup do
|
|
78
78
|
group.options.should have_key('example')
|
79
79
|
end
|
80
80
|
|
81
|
+
it 'creates a boolean option' do
|
82
|
+
group = described_class.new do
|
83
|
+
option_bool 'example', true
|
84
|
+
end
|
85
|
+
|
86
|
+
group.options.should have_key('example')
|
87
|
+
group.options['example'].should be_a(Configru::Option)
|
88
|
+
group.options['example'].type.should == Object
|
89
|
+
group.options['example'].default.should == true
|
90
|
+
group.options['example'].validation.should == [true, false]
|
91
|
+
group.options['example'].transformation.should be_nil
|
92
|
+
end
|
93
|
+
|
81
94
|
it 'creates a required option' do
|
82
95
|
group = described_class.new do
|
83
96
|
option_required 'example'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis McEnroe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: YAML configuration file loader
|
14
14
|
email:
|
@@ -63,21 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.0.
|
66
|
+
rubygems_version: 2.0.2
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: YAML configuration file loader
|
70
|
-
test_files:
|
71
|
-
- spec/configru_spec.rb
|
72
|
-
- spec/dsl_spec.rb
|
73
|
-
- spec/example_files/example_a.yml
|
74
|
-
- spec/example_files/example_b.yml
|
75
|
-
- spec/example_files/example_c.yml
|
76
|
-
- spec/example_files/example_d.yml
|
77
|
-
- spec/example_files/example_e.yml
|
78
|
-
- spec/example_files/example_f.yml
|
79
|
-
- spec/example_files/example_g.yml
|
80
|
-
- spec/example_files/example_h.yml
|
81
|
-
- spec/example_files/example_i.yml
|
82
|
-
- spec/spec_helper.rb
|
83
|
-
- spec/structhash_spec.rb
|
70
|
+
test_files: []
|