loquacious 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +56 -50
- data/lib/loquacious/configuration.rb +28 -0
- data/lib/loquacious/configuration/iterator.rb +3 -4
- data/spec/configuration_spec.rb +117 -83
- data/spec/help_spec.rb +18 -18
- data/spec/iterator_spec.rb +26 -17
- data/spec/loquacious_spec.rb +11 -11
- data/spec/string_spec.rb +13 -13
- data/version.txt +1 -1
- metadata +45 -97
- data/tmp.rb +0 -15
data/History.txt
CHANGED
@@ -1,116 +1,122 @@
|
|
1
|
+
== 1.9.0 / 2011-09-13
|
2
|
+
|
3
|
+
Enhancements
|
4
|
+
- Iterator now skips Undefined values
|
5
|
+
- Method to convert Configuration objects to a hash [mcmire]
|
6
|
+
|
1
7
|
== 1.8.1 / 2011-06-09
|
2
8
|
|
3
9
|
Bug Fixes
|
4
|
-
|
10
|
+
- Assignment methods now mirror one another in their return values
|
5
11
|
|
6
12
|
== 1.8.0 / 2011-06-03
|
7
13
|
|
8
14
|
Enhancements
|
9
|
-
|
15
|
+
- Support for defalut values on configuration properties
|
10
16
|
|
11
17
|
== 1.7.1 / 2011-02-11
|
12
18
|
|
13
19
|
Bug Fixes
|
14
|
-
|
20
|
+
- Fixing the "alias instance_eval" warning on JRuby
|
15
21
|
|
16
22
|
== 1.7.0 / 2010-08-16
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
Enhancements
|
25
|
+
- Adding a "copy" function for configuration objects
|
26
|
+
Bug Fixes
|
27
|
+
- Fixing warnings
|
22
28
|
|
23
29
|
== 1.6.4 / 2010-06-08
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
Bug Fixes
|
32
|
+
- Extending a configuration was not working properly
|
33
|
+
- Descriptions were being overwritten when extending a configuration
|
28
34
|
|
29
35
|
== 1.6.3 / 2010-06-07
|
30
36
|
|
31
|
-
|
32
|
-
|
37
|
+
Bug Fixes
|
38
|
+
- Assign a nil description when none is given [Nathan Witmer]
|
33
39
|
|
34
40
|
== 1.6.2 / 2010-06-01
|
35
41
|
|
36
|
-
|
37
|
-
|
42
|
+
Bug Fixes
|
43
|
+
- Compatibility with Ruby 1.9.2
|
38
44
|
|
39
45
|
== 1.6.1 / 2010-04-19
|
40
46
|
|
41
|
-
|
42
|
-
|
47
|
+
Bug Fixes
|
48
|
+
- Allow interrogative methods on configuration objects (nil?)
|
43
49
|
|
44
50
|
== 1.6.0 / 2010-04-18
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
Enhancements
|
53
|
+
- Added a default "undefined" value
|
48
54
|
|
49
55
|
== 1.5.2 / 2010-04-06
|
50
56
|
|
51
|
-
|
52
|
-
|
57
|
+
Bug Fixes
|
58
|
+
- Accidentally undefining the initialize method for the DSL
|
53
59
|
|
54
60
|
== 1.5.1 / 2010-04-06
|
55
61
|
|
56
|
-
|
57
|
-
|
62
|
+
Bug Fixes
|
63
|
+
- Private methods were accessible in the configuration objects
|
58
64
|
|
59
65
|
== 1.5.0 / 2010-03-11
|
60
66
|
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
Enhancements
|
68
|
+
- Adding support for evaluation of Proc objects
|
69
|
+
- Upgrading to the latest Mr Bones
|
64
70
|
|
65
71
|
|
66
72
|
== 1.4.2 / 2010-02-01
|
67
73
|
|
68
|
-
|
69
|
-
|
74
|
+
Bug Fixes
|
75
|
+
- Resolving some circular dependencies
|
70
76
|
|
71
77
|
== 1.4.1 / 2009-11-29
|
72
78
|
|
73
|
-
|
74
|
-
|
75
|
-
|
79
|
+
Bug Fixes
|
80
|
+
- Fixing warning message from jRuby
|
81
|
+
- Kernel methods can now be used as configuration attributes
|
76
82
|
|
77
83
|
== 1.4.0 / 2009-11-07
|
78
84
|
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
Enhancements
|
86
|
+
- Added a help option to hide nesting configuration atrributes
|
87
|
+
- Update to Mr Bones 3.0.0
|
82
88
|
|
83
89
|
== 1.3.1 / 2009-10-30
|
84
90
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
Enhancements
|
92
|
+
- Added a remove method to clobber unwanted methods in the configuration
|
93
|
+
Bug Fixes
|
94
|
+
- Could not assign false as a default value
|
89
95
|
|
90
96
|
== 1.3.0 / 2009-04-05
|
91
97
|
|
92
|
-
|
93
|
-
|
98
|
+
Enhancements
|
99
|
+
- Adding colorization options to the Help object
|
94
100
|
|
95
101
|
== 1.2.0 / 2009-04-05
|
96
102
|
|
97
|
-
|
98
|
-
|
103
|
+
Enhancements
|
104
|
+
- Help#show now matches using a regular expression
|
99
105
|
|
100
106
|
== 1.1.1 / 2009-04-05
|
101
107
|
|
102
|
-
|
103
|
-
|
104
|
-
|
108
|
+
Bug Fixes
|
109
|
+
- You can no longer use object_id as a configuration value
|
110
|
+
(Ruby 1.9 is very cranky if object_id gets undefined)
|
105
111
|
|
106
112
|
== 1.1.0 / 2009-04-05
|
107
113
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
114
|
+
Enhancements
|
115
|
+
- Added hash accessor methods for configuration attributes
|
116
|
+
Bug Fixes
|
117
|
+
- Hash values were not being handeld properly by the DSL
|
112
118
|
|
113
119
|
== 1.0.0 / 2009-04-04
|
114
120
|
|
115
|
-
|
116
|
-
|
121
|
+
Enhancements
|
122
|
+
- Birthday!
|
@@ -82,6 +82,29 @@ module Loquacious
|
|
82
82
|
::Loquacious::Configuration::Help.new(name, opts)
|
83
83
|
end
|
84
84
|
alias :help :help_for
|
85
|
+
|
86
|
+
# call-seq:
|
87
|
+
# Configuration.to_hash( config )
|
88
|
+
#
|
89
|
+
# Recursively convert a configuration object to a hash.
|
90
|
+
#
|
91
|
+
def to_hash( config )
|
92
|
+
cache = { nil => {} }
|
93
|
+
|
94
|
+
Iterator.new(config).each do |node|
|
95
|
+
ary = node.name.split('.')
|
96
|
+
name = ary.pop.to_sym
|
97
|
+
parent = ary.empty? ? nil : ary.join('.')
|
98
|
+
|
99
|
+
if node.config?
|
100
|
+
cache[node.name] = cache[parent][name] = {}
|
101
|
+
else
|
102
|
+
cache[parent][name] = node.obj
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
return cache[nil]
|
107
|
+
end
|
85
108
|
end
|
86
109
|
|
87
110
|
instance_methods(true).each do |m|
|
@@ -245,6 +268,11 @@ module Loquacious
|
|
245
268
|
self.__send(key, value)
|
246
269
|
end
|
247
270
|
|
271
|
+
# Recursively convert the configuration object to a hash.
|
272
|
+
#
|
273
|
+
def to_hash
|
274
|
+
::Loquacious::Configuration.to_hash(self)
|
275
|
+
end
|
248
276
|
|
249
277
|
# Implementation of a domain specific language for creating configuration
|
250
278
|
# objects. Blocks of code are evaluted by the DSL which returns a new
|
@@ -108,6 +108,7 @@ class Loquacious::Configuration
|
|
108
108
|
frame.index += 1
|
109
109
|
stack << new_frame(node.obj, node.name) if node.config?
|
110
110
|
|
111
|
+
node = next_node if node.undefined?
|
111
112
|
return node
|
112
113
|
end
|
113
114
|
|
@@ -145,10 +146,8 @@ class Loquacious::Configuration
|
|
145
146
|
#
|
146
147
|
Node = Struct.new( :config, :name, :desc, :key ) {
|
147
148
|
def config?() obj.kind_of? ::Loquacious::Configuration; end
|
148
|
-
def
|
149
|
-
|
150
|
-
o.kind_of?(::Loquacious::Undefined) ? nil : o
|
151
|
-
end
|
149
|
+
def undefined?() obj.kind_of? ::Loquacious::Undefined; end
|
150
|
+
def obj() config.__send__(key); end
|
152
151
|
}
|
153
152
|
|
154
153
|
end # class Iterator
|
data/spec/configuration_spec.rb
CHANGED
@@ -11,27 +11,27 @@ describe Loquacious::Configuration do
|
|
11
11
|
first 'foo'
|
12
12
|
second 'bar'
|
13
13
|
}
|
14
|
-
obj.first.should == 'foo'
|
15
|
-
obj.second.should == 'bar'
|
14
|
+
obj.first.should be == 'foo'
|
15
|
+
obj.second.should be == 'bar'
|
16
16
|
obj.third.should be_nil
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should respond to any method' do
|
20
20
|
@obj.first.should be_nil
|
21
21
|
@obj.first = 'foo'
|
22
|
-
@obj.first.should == 'foo'
|
22
|
+
@obj.first.should be == 'foo'
|
23
23
|
|
24
24
|
@obj.second = 'bar'
|
25
|
-
@obj.second.should == 'bar'
|
25
|
+
@obj.second.should be == 'bar'
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should deine attribute accessors when first used' do
|
29
|
-
@obj.respond_to?(:foo).should == false
|
30
|
-
@obj.respond_to?(:foo=).should == false
|
29
|
+
@obj.respond_to?(:foo).should be == false
|
30
|
+
@obj.respond_to?(:foo=).should be == false
|
31
31
|
|
32
32
|
@obj.foo
|
33
|
-
@obj.respond_to?(:foo).should == true
|
34
|
-
@obj.respond_to?(:foo=).should == true
|
33
|
+
@obj.respond_to?(:foo).should be == true
|
34
|
+
@obj.respond_to?(:foo=).should be == true
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should provide a hash object for storing method descriptions' do
|
@@ -43,7 +43,7 @@ describe Loquacious::Configuration do
|
|
43
43
|
cfg = Loquacious::Configuration.new {
|
44
44
|
hash({:one => 1})
|
45
45
|
}
|
46
|
-
cfg.hash.should == {:one => 1}
|
46
|
+
cfg.hash.should be == {:one => 1}
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should provide hash accessor notation for attributes' do
|
@@ -53,17 +53,17 @@ describe Loquacious::Configuration do
|
|
53
53
|
three 3
|
54
54
|
}
|
55
55
|
|
56
|
-
cfg['one'].should == 1
|
57
|
-
cfg[:two].should == 2
|
58
|
-
cfg['three'].should == 3
|
56
|
+
cfg['one'].should be == 1
|
57
|
+
cfg[:two].should be == 2
|
58
|
+
cfg['three'].should be == 3
|
59
59
|
|
60
60
|
cfg[:four].should be_nil
|
61
61
|
cfg.four = 4
|
62
|
-
cfg[:four].should == 4
|
62
|
+
cfg[:four].should be == 4
|
63
63
|
|
64
64
|
cfg[:five] = 5
|
65
|
-
cfg.five.should == 5
|
66
|
-
cfg[:five].should == 5
|
65
|
+
cfg.five.should be == 5
|
66
|
+
cfg[:five].should be == 5
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should allow Kernel methods to be treated as configuration attributes' do
|
@@ -74,20 +74,20 @@ describe Loquacious::Configuration do
|
|
74
74
|
puts 'not what you think'
|
75
75
|
}
|
76
76
|
|
77
|
-
cfg['fork'].should == 'spoon knife spork'
|
78
|
-
cfg['split'].should == 'join'
|
79
|
-
cfg['raise'].should == 'double down'
|
80
|
-
cfg['puts'].should == 'not what you think'
|
77
|
+
cfg['fork'].should be == 'spoon knife spork'
|
78
|
+
cfg['split'].should be == 'join'
|
79
|
+
cfg['raise'].should be == 'double down'
|
80
|
+
cfg['puts'].should be == 'not what you think'
|
81
81
|
|
82
|
-
cfg[:fork].should == 'spoon knife spork'
|
83
|
-
cfg[:split].should == 'join'
|
84
|
-
cfg[:raise].should == 'double down'
|
85
|
-
cfg[:puts].should == 'not what you think'
|
82
|
+
cfg[:fork].should be == 'spoon knife spork'
|
83
|
+
cfg[:split].should be == 'join'
|
84
|
+
cfg[:raise].should be == 'double down'
|
85
|
+
cfg[:puts].should be == 'not what you think'
|
86
86
|
|
87
|
-
cfg.fork.should == 'spoon knife spork'
|
88
|
-
cfg.split.should == 'join'
|
89
|
-
cfg.raise.should == 'double down'
|
90
|
-
cfg.puts.should == 'not what you think'
|
87
|
+
cfg.fork.should be == 'spoon knife spork'
|
88
|
+
cfg.split.should be == 'join'
|
89
|
+
cfg.raise.should be == 'double down'
|
90
|
+
cfg.puts.should be == 'not what you think'
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should not be affected by loading other modules like timeout' do
|
@@ -98,9 +98,9 @@ describe Loquacious::Configuration do
|
|
98
98
|
foo 'bar'
|
99
99
|
baz 'buz'
|
100
100
|
}
|
101
|
-
cfg.timeout.should == 10
|
102
|
-
cfg.foo.should == 'bar'
|
103
|
-
cfg.baz.should == 'buz'
|
101
|
+
cfg.timeout.should be == 10
|
102
|
+
cfg.foo.should be == 'bar'
|
103
|
+
cfg.baz.should be == 'buz'
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should evaluate Proc objects when fetching values' do
|
@@ -110,14 +110,14 @@ describe Loquacious::Configuration do
|
|
110
110
|
}
|
111
111
|
|
112
112
|
obj.third = Proc.new { obj.first + obj.second }
|
113
|
-
obj.third.should == 'foobar'
|
113
|
+
obj.third.should be == 'foobar'
|
114
114
|
|
115
115
|
obj.second = 'baz'
|
116
|
-
obj.third.should == 'foobaz'
|
116
|
+
obj.third.should be == 'foobaz'
|
117
117
|
|
118
118
|
obj.first = 'Hello '
|
119
119
|
obj.second = 'World!'
|
120
|
-
obj.third.should == 'Hello World!'
|
120
|
+
obj.third.should be == 'Hello World!'
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'should return a value when evaluating inside the DSL' do
|
@@ -128,7 +128,7 @@ describe Loquacious::Configuration do
|
|
128
128
|
}
|
129
129
|
}
|
130
130
|
|
131
|
-
obj.first.should == 'foo'
|
131
|
+
obj.first.should be == 'foo'
|
132
132
|
obj.second.bar.should be_nil
|
133
133
|
|
134
134
|
Loquacious::Configuration::DSL.evaluate(:config => obj) {
|
@@ -136,8 +136,8 @@ describe Loquacious::Configuration do
|
|
136
136
|
second.bar 'no longer nil'
|
137
137
|
}
|
138
138
|
|
139
|
-
obj.first.should == 'bar'
|
140
|
-
obj.second.bar.should == 'no longer nil'
|
139
|
+
obj.first.should be == 'bar'
|
140
|
+
obj.second.bar.should be == 'no longer nil'
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'should not delete descriptions' do
|
@@ -150,24 +150,24 @@ describe Loquacious::Configuration do
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
153
|
-
obj.first.should == 'foo'
|
153
|
+
obj.first.should be == 'foo'
|
154
154
|
obj.second.bar.should be_nil
|
155
155
|
|
156
|
-
obj.__desc[:first].should == 'the first value'
|
157
|
-
obj.__desc[:second].should == 'the second value'
|
158
|
-
obj.second.__desc[:bar].should == 'time to go drinking'
|
156
|
+
obj.__desc[:first].should be == 'the first value'
|
157
|
+
obj.__desc[:second].should be == 'the second value'
|
158
|
+
obj.second.__desc[:bar].should be == 'time to go drinking'
|
159
159
|
|
160
160
|
Loquacious::Configuration::DSL.evaluate(:config => obj) {
|
161
161
|
first 'bar'
|
162
162
|
second.bar 'no longer nil'
|
163
163
|
}
|
164
164
|
|
165
|
-
obj.first.should == 'bar'
|
166
|
-
obj.second.bar.should == 'no longer nil'
|
165
|
+
obj.first.should be == 'bar'
|
166
|
+
obj.second.bar.should be == 'no longer nil'
|
167
167
|
|
168
|
-
obj.__desc[:first].should == 'the first value'
|
169
|
-
obj.__desc[:second].should == 'the second value'
|
170
|
-
obj.second.__desc[:bar].should == 'time to go drinking'
|
168
|
+
obj.__desc[:first].should be == 'the first value'
|
169
|
+
obj.__desc[:second].should be == 'the second value'
|
170
|
+
obj.second.__desc[:bar].should be == 'time to go drinking'
|
171
171
|
end
|
172
172
|
|
173
173
|
# -----------------------------------------------------------------------
|
@@ -181,12 +181,12 @@ describe Loquacious::Configuration do
|
|
181
181
|
|
182
182
|
@obj.first.should be_nil
|
183
183
|
@obj.second.should be_nil
|
184
|
-
@obj.__desc.should == {:first => nil, :second => nil}
|
184
|
+
@obj.__desc.should be == {:first => nil, :second => nil}
|
185
185
|
|
186
186
|
@obj.merge! other
|
187
|
-
@obj.first.should == 'foo'
|
188
|
-
@obj.second.should == 'bar'
|
189
|
-
@obj.__desc.should == {
|
187
|
+
@obj.first.should be == 'foo'
|
188
|
+
@obj.second.should be == 'bar'
|
189
|
+
@obj.__desc.should be == {
|
190
190
|
:first => 'foo method',
|
191
191
|
:second => 'bar method'
|
192
192
|
}
|
@@ -211,17 +211,17 @@ describe Loquacious::Configuration do
|
|
211
211
|
|
212
212
|
@obj.merge! other
|
213
213
|
|
214
|
-
@obj.first.should == 'foo'
|
215
|
-
@obj.second.should == 'bar'
|
216
|
-
@obj.third.question.should == '?'
|
217
|
-
@obj.third.answer.should == 42
|
214
|
+
@obj.first.should be == 'foo'
|
215
|
+
@obj.second.should be == 'bar'
|
216
|
+
@obj.third.question.should be == '?'
|
217
|
+
@obj.third.answer.should be == 42
|
218
218
|
|
219
|
-
@obj.__desc.should == {
|
219
|
+
@obj.__desc.should be == {
|
220
220
|
:first => 'foo method',
|
221
221
|
:second => 'bar method',
|
222
222
|
:third => 'the third group'
|
223
223
|
}
|
224
|
-
@obj.third.__desc.should == {
|
224
|
+
@obj.third.__desc.should be == {
|
225
225
|
:question => 'perhaps you do not understand',
|
226
226
|
:answer => 'life the universe and everything'
|
227
227
|
}
|
@@ -246,8 +246,8 @@ describe Loquacious::Configuration do
|
|
246
246
|
second 'bar', :desc => "bar method\n also a multiline comment"
|
247
247
|
}
|
248
248
|
|
249
|
-
other.__desc[:first].should == "This is the first thing we are defining in this config.\nIt has a multiline comment."
|
250
|
-
other.__desc[:second].should == "bar method\nalso a multiline comment"
|
249
|
+
other.__desc[:first].should be == "This is the first thing we are defining in this config.\nIt has a multiline comment."
|
250
|
+
other.__desc[:second].should be == "bar method\nalso a multiline comment"
|
251
251
|
end
|
252
252
|
|
253
253
|
it 'should leave whitespace after a gutter marker' do
|
@@ -268,8 +268,8 @@ describe Loquacious::Configuration do
|
|
268
268
|
second 'bar'
|
269
269
|
}
|
270
270
|
|
271
|
-
other.__desc[:first].should == " This is the first thing we are defining in this config.\n It has a multiline comment."
|
272
|
-
other.__desc[:second].should == "This is a short explanation\n\nExample:\n do this then that\n followed by this line"
|
271
|
+
other.__desc[:first].should be == " This is the first thing we are defining in this config.\n It has a multiline comment."
|
272
|
+
other.__desc[:second].should be == "This is a short explanation\n\nExample:\n do this then that\n followed by this line"
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
@@ -289,7 +289,7 @@ describe Loquacious::Configuration do
|
|
289
289
|
}
|
290
290
|
|
291
291
|
c = Loquacious::Configuration.for 'test'
|
292
|
-
c.first.should == 'foo'
|
292
|
+
c.first.should be == 'foo'
|
293
293
|
c.second.bar.should be_nil
|
294
294
|
end
|
295
295
|
|
@@ -307,13 +307,13 @@ describe Loquacious::Configuration do
|
|
307
307
|
}
|
308
308
|
}
|
309
309
|
|
310
|
-
c.first.should == 1
|
311
|
-
c.third.should == 3
|
310
|
+
c.first.should be == 1
|
311
|
+
c.third.should be == 3
|
312
312
|
c.second.bar.should be_nil
|
313
313
|
|
314
|
-
c.__desc[:first].should == 'the first value'
|
315
|
-
c.__desc[:second].should == 'the second value'
|
316
|
-
c.second.__desc[:bar].should == 'time to go drinking'
|
314
|
+
c.__desc[:first].should be == 'the first value'
|
315
|
+
c.__desc[:second].should be == 'the second value'
|
316
|
+
c.second.__desc[:bar].should be == 'time to go drinking'
|
317
317
|
c.__desc[:thrid].should be_nil
|
318
318
|
end
|
319
319
|
|
@@ -343,21 +343,21 @@ describe Loquacious::Configuration do
|
|
343
343
|
}
|
344
344
|
}
|
345
345
|
|
346
|
-
c.first.should == 1
|
347
|
-
c.third.should == 3
|
348
|
-
c.second.bar.should == 'pub'
|
349
|
-
c.second.baz.buz.should == 'random text'
|
350
|
-
c.second.baz.boo.should == 'who'
|
346
|
+
c.first.should be == 1
|
347
|
+
c.third.should be == 3
|
348
|
+
c.second.bar.should be == 'pub'
|
349
|
+
c.second.baz.buz.should be == 'random text'
|
350
|
+
c.second.baz.boo.should be == 'who'
|
351
351
|
|
352
352
|
c.second.bar = Loquacious::Undefined.new('second.bar')
|
353
|
-
c.second.bar.should == 'h-bar'
|
354
|
-
|
355
|
-
c.__desc[:first].should == 'the first value'
|
356
|
-
c.__desc[:second].should == 'the second value'
|
357
|
-
c.second.__desc[:bar].should == 'time to go drinking'
|
358
|
-
c.second.__desc[:baz].should == 'getting weird'
|
359
|
-
c.second.baz.__desc[:buz].should == 'post drinking feeling'
|
360
|
-
c.second.baz.__desc[:boo].should == 'no need to cry about it'
|
353
|
+
c.second.bar.should be == 'h-bar'
|
354
|
+
|
355
|
+
c.__desc[:first].should be == 'the first value'
|
356
|
+
c.__desc[:second].should be == 'the second value'
|
357
|
+
c.second.__desc[:bar].should be == 'time to go drinking'
|
358
|
+
c.second.__desc[:baz].should be == 'getting weird'
|
359
|
+
c.second.baz.__desc[:buz].should be == 'post drinking feeling'
|
360
|
+
c.second.baz.__desc[:boo].should be == 'no need to cry about it'
|
361
361
|
c.__desc[:thrid].should be_nil
|
362
362
|
end
|
363
363
|
|
@@ -384,12 +384,12 @@ describe Loquacious::Configuration do
|
|
384
384
|
}
|
385
385
|
}
|
386
386
|
|
387
|
-
c.second.baz.buz.should == 'random text'
|
388
|
-
c.second.baz.boo.should == 'who'
|
387
|
+
c.second.baz.buz.should be == 'random text'
|
388
|
+
c.second.baz.boo.should be == 'who'
|
389
389
|
|
390
390
|
c.second.baz = Loquacious::Undefined.new('second.bar')
|
391
391
|
c.second.baz.should be_nil
|
392
|
-
c.second.__desc[:baz].should == 'deprecated'
|
392
|
+
c.second.__desc[:baz].should be == 'deprecated'
|
393
393
|
end
|
394
394
|
|
395
395
|
it 'properly handles Proc default values' do
|
@@ -410,8 +410,42 @@ describe Loquacious::Configuration do
|
|
410
410
|
}
|
411
411
|
}
|
412
412
|
|
413
|
-
c.second.baz.should == 36
|
414
|
-
c.second.__desc[:baz].should == 'proc will be evaluated'
|
413
|
+
c.second.baz.should be == 36
|
414
|
+
c.second.__desc[:baz].should be == 'proc will be evaluated'
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
# -----------------------------------------------------------------------
|
419
|
+
describe 'when converting to a hash' do
|
420
|
+
it "should do so recursively" do
|
421
|
+
c = Loquacious::Configuration.new {
|
422
|
+
first 1, :desc => 'one is the loneliest number'
|
423
|
+
second {
|
424
|
+
bar 'pub', :desc => 'where the magic happens'
|
425
|
+
desc 'overwrite me'
|
426
|
+
baz {
|
427
|
+
buz 'random text'
|
428
|
+
boo 'who'
|
429
|
+
}
|
430
|
+
}
|
431
|
+
third 3
|
432
|
+
}
|
433
|
+
c.to_hash.should == {
|
434
|
+
:first => 1,
|
435
|
+
:second => {
|
436
|
+
:bar => 'pub',
|
437
|
+
:baz => {
|
438
|
+
:buz => 'random text',
|
439
|
+
:boo => 'who'
|
440
|
+
}
|
441
|
+
},
|
442
|
+
:third => 3
|
443
|
+
}
|
444
|
+
end
|
445
|
+
|
446
|
+
it "just returns an empty hash for an empty configuration" do
|
447
|
+
c = Loquacious::Configuration.new { }
|
448
|
+
c.to_hash.should == {}
|
415
449
|
end
|
416
450
|
end
|
417
451
|
|
data/spec/help_spec.rb
CHANGED
@@ -52,7 +52,7 @@ describe Loquacious::Configuration::Help do
|
|
52
52
|
OUTPUT
|
53
53
|
|
54
54
|
@help.show_all
|
55
|
-
@sio.to_s.should == str.gutter!
|
55
|
+
@sio.to_s.should be == str.gutter!
|
56
56
|
end
|
57
57
|
|
58
58
|
it "prints out a specific attribute" do
|
@@ -62,7 +62,7 @@ describe Loquacious::Configuration::Help do
|
|
62
62
|
|
|
63
63
|
OUTPUT
|
64
64
|
@help.show_attribute :second
|
65
|
-
@sio.to_s.should == str.gutter!
|
65
|
+
@sio.to_s.should be == str.gutter!
|
66
66
|
end
|
67
67
|
|
68
68
|
it "properly parses nested attributes" do
|
@@ -78,7 +78,7 @@ describe Loquacious::Configuration::Help do
|
|
78
78
|
|
|
79
79
|
OUTPUT
|
80
80
|
@help.show_attribute 'third'
|
81
|
-
@sio.to_s.should == str.gutter!
|
81
|
+
@sio.to_s.should be == str.gutter!
|
82
82
|
|
83
83
|
@sio.clear
|
84
84
|
str = <<-OUTPUT
|
@@ -87,7 +87,7 @@ describe Loquacious::Configuration::Help do
|
|
87
87
|
|
|
88
88
|
OUTPUT
|
89
89
|
@help.show_attribute %w[third question]
|
90
|
-
@sio.to_s.should == str.gutter!
|
90
|
+
@sio.to_s.should be == str.gutter!
|
91
91
|
|
92
92
|
@sio.clear
|
93
93
|
str = <<-OUTPUT
|
@@ -96,7 +96,7 @@ describe Loquacious::Configuration::Help do
|
|
96
96
|
|
|
97
97
|
OUTPUT
|
98
98
|
@help.show_attribute 'third.answer'
|
99
|
-
@sio.to_s.should == str.gutter!
|
99
|
+
@sio.to_s.should be == str.gutter!
|
100
100
|
end
|
101
101
|
|
102
102
|
it "hides nesting attributes" do
|
@@ -118,7 +118,7 @@ describe Loquacious::Configuration::Help do
|
|
118
118
|
OUTPUT
|
119
119
|
|
120
120
|
help.show_all
|
121
|
-
@sio.to_s.should == str.gutter!
|
121
|
+
@sio.to_s.should be == str.gutter!
|
122
122
|
|
123
123
|
@sio.clear
|
124
124
|
str = <<-OUTPUT
|
@@ -130,7 +130,7 @@ describe Loquacious::Configuration::Help do
|
|
130
130
|
|
|
131
131
|
OUTPUT
|
132
132
|
help.show_attribute 'third'
|
133
|
-
@sio.to_s.should == str.gutter!
|
133
|
+
@sio.to_s.should be == str.gutter!
|
134
134
|
|
135
135
|
@sio.clear
|
136
136
|
end
|
@@ -159,7 +159,7 @@ describe Loquacious::Configuration::Help do
|
|
159
159
|
|
|
160
160
|
OUTPUT
|
161
161
|
@help.show_attribute 'fourth'
|
162
|
-
@sio.to_s.should == str.gutter!
|
162
|
+
@sio.to_s.should be == str.gutter!
|
163
163
|
end
|
164
164
|
|
165
165
|
it "pretty prints values" do
|
@@ -181,7 +181,7 @@ describe Loquacious::Configuration::Help do
|
|
181
181
|
|
|
182
182
|
OUTPUT
|
183
183
|
@help.show :values => true
|
184
|
-
@sio.to_s.should == str.gutter!
|
184
|
+
@sio.to_s.should be == str.gutter!
|
185
185
|
end
|
186
186
|
|
187
187
|
it "closely packs attributes when descriptions are omitted" do
|
@@ -193,7 +193,7 @@ describe Loquacious::Configuration::Help do
|
|
193
193
|
| - third.question => :symbol
|
194
194
|
OUTPUT
|
195
195
|
@help.show_all :values => true, :descriptions => false
|
196
|
-
@sio.to_s.should == str.gutter!
|
196
|
+
@sio.to_s.should be == str.gutter!
|
197
197
|
end
|
198
198
|
|
199
199
|
it "automatically picks up changes to the configuration" do
|
@@ -207,7 +207,7 @@ describe Loquacious::Configuration::Help do
|
|
207
207
|
|
|
208
208
|
OUTPUT
|
209
209
|
@help.show_attribute 'fifth'
|
210
|
-
@sio.to_s.should == str.gutter!
|
210
|
+
@sio.to_s.should be == str.gutter!
|
211
211
|
end
|
212
212
|
|
213
213
|
it "uses a custom name leader" do
|
@@ -230,7 +230,7 @@ describe Loquacious::Configuration::Help do
|
|
230
230
|
|
|
231
231
|
OUTPUT
|
232
232
|
help.show_all
|
233
|
-
@sio.to_s.should == str.gutter!
|
233
|
+
@sio.to_s.should be == str.gutter!
|
234
234
|
|
235
235
|
@sio.clear
|
236
236
|
str = <<-OUTPUT
|
@@ -241,7 +241,7 @@ describe Loquacious::Configuration::Help do
|
|
241
241
|
| ## third.question => :symbol
|
242
242
|
OUTPUT
|
243
243
|
help.show_all :values => true, :descriptions => false
|
244
|
-
@sio.to_s.should == str.gutter!
|
244
|
+
@sio.to_s.should be == str.gutter!
|
245
245
|
end
|
246
246
|
|
247
247
|
it "uses a custom name length" do
|
@@ -264,7 +264,7 @@ describe Loquacious::Configuration::Help do
|
|
264
264
|
|
|
265
265
|
OUTPUT
|
266
266
|
help.show_all
|
267
|
-
@sio.to_s.should == str.gutter!
|
267
|
+
@sio.to_s.should be == str.gutter!
|
268
268
|
|
269
269
|
@sio.clear
|
270
270
|
str = <<-OUTPUT
|
@@ -275,7 +275,7 @@ describe Loquacious::Configuration::Help do
|
|
275
275
|
| - thir...ion => :symbol
|
276
276
|
OUTPUT
|
277
277
|
help.show_all :values => true, :descriptions => false
|
278
|
-
@sio.to_s.should == str.gutter!
|
278
|
+
@sio.to_s.should be == str.gutter!
|
279
279
|
end
|
280
280
|
|
281
281
|
it "uses a custom name/value separator" do
|
@@ -298,7 +298,7 @@ describe Loquacious::Configuration::Help do
|
|
298
298
|
|
|
299
299
|
OUTPUT
|
300
300
|
help.show_all :values => true
|
301
|
-
@sio.to_s.should == str.gutter!
|
301
|
+
@sio.to_s.should be == str.gutter!
|
302
302
|
|
303
303
|
@sio.clear
|
304
304
|
str = <<-OUTPUT
|
@@ -309,7 +309,7 @@ describe Loquacious::Configuration::Help do
|
|
309
309
|
| - third.question :: :symbol
|
310
310
|
OUTPUT
|
311
311
|
help.show_all :values => true, :descriptions => false
|
312
|
-
@sio.to_s.should == str.gutter!
|
312
|
+
@sio.to_s.should be == str.gutter!
|
313
313
|
end
|
314
314
|
|
315
315
|
it "uses a custom description leader" do
|
@@ -352,7 +352,7 @@ describe Loquacious::Configuration::Help do
|
|
352
352
|
|
|
353
353
|
OUTPUT
|
354
354
|
help.show_all :values => true
|
355
|
-
@sio.to_s.should == str.gutter!
|
355
|
+
@sio.to_s.should be == str.gutter!
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
data/spec/iterator_spec.rb
CHANGED
@@ -10,24 +10,24 @@ describe Loquacious::Configuration::Iterator do
|
|
10
10
|
|
11
11
|
it 'should find a particular attribute' do
|
12
12
|
node = @iterator.find 'first'
|
13
|
-
node.name.should == 'first'
|
14
|
-
node.key.should == :first
|
15
|
-
node.desc.should == 'foo method'
|
16
|
-
node.obj.should == 'foo'
|
17
|
-
node.config?.should == false
|
13
|
+
node.name.should be == 'first'
|
14
|
+
node.key.should be == :first
|
15
|
+
node.desc.should be == 'foo method'
|
16
|
+
node.obj.should be == 'foo'
|
17
|
+
node.config?.should be == false
|
18
18
|
|
19
19
|
node = @iterator.find :third
|
20
|
-
node.name.should == 'third'
|
21
|
-
node.key.should == :third
|
22
|
-
node.desc.should == 'the third group'
|
23
|
-
node.config?.should == true
|
20
|
+
node.name.should be == 'third'
|
21
|
+
node.key.should be == :third
|
22
|
+
node.desc.should be == 'the third group'
|
23
|
+
node.config?.should be == true
|
24
24
|
|
25
25
|
node = @iterator.find('third.answer')
|
26
|
-
node.name.should == 'third.answer'
|
27
|
-
node.key.should == :answer
|
28
|
-
node.desc.should == 'life the universe and everything'
|
29
|
-
node.obj.should == 42
|
30
|
-
node.config?.should == false
|
26
|
+
node.name.should be == 'third.answer'
|
27
|
+
node.key.should be == :answer
|
28
|
+
node.desc.should be == 'life the universe and everything'
|
29
|
+
node.obj.should be == 42
|
30
|
+
node.config?.should be == false
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should return nil for unknown attributes' do
|
@@ -41,22 +41,31 @@ describe Loquacious::Configuration::Iterator do
|
|
41
41
|
ary = Array.new
|
42
42
|
@iterator.each {|n| ary << n.name}
|
43
43
|
|
44
|
-
ary.should == %w{first second third third.answer third.question}
|
44
|
+
ary.should be == %w{first second third third.answer third.question}
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should iterate over nested attributes if given' do
|
48
48
|
ary = Array.new
|
49
49
|
@iterator.each('third') {|n| ary << n.name}
|
50
|
-
ary.should == %w{third third.answer third.question}
|
50
|
+
ary.should be == %w{third third.answer third.question}
|
51
51
|
|
52
52
|
ary.clear
|
53
53
|
@iterator.each('first') {|n| ary << n.name}
|
54
|
-
ary.should == %w{first}
|
54
|
+
ary.should be == %w{first}
|
55
55
|
|
56
56
|
ary.clear
|
57
57
|
@iterator.each('not_here') {|n| ary << n.name}
|
58
58
|
ary.should be_empty
|
59
59
|
end
|
60
|
+
|
61
|
+
it 'should ignore undefined nodes' do
|
62
|
+
@config.does_not_exist.foo # this creates a Loquacious::Undefined node
|
63
|
+
@config.does_not_exist.kind_of?(::Loquacious::Undefined).should be_true
|
64
|
+
|
65
|
+
ary = Array.new
|
66
|
+
@iterator.each {|n| ary << n.name}
|
67
|
+
ary.should be == %w{first second third third.answer third.question}
|
68
|
+
end
|
60
69
|
end
|
61
70
|
|
62
71
|
# EOF
|
data/spec/loquacious_spec.rb
CHANGED
@@ -11,11 +11,11 @@ describe Loquacious do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "finds things releative to 'lib'" do
|
14
|
-
Loquacious.libpath(%w[loquacious config.rb]).should == File.join(@root_dir, %w[lib loquacious config.rb])
|
14
|
+
Loquacious.libpath(%w[loquacious config.rb]).should be == File.join(@root_dir, %w[lib loquacious config.rb])
|
15
15
|
end
|
16
16
|
|
17
17
|
it "finds things releative to 'root'" do
|
18
|
-
Loquacious.path('Rakefile').should == File.join(@root_dir, 'Rakefile')
|
18
|
+
Loquacious.path('Rakefile').should be == File.join(@root_dir, 'Rakefile')
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "when copying configuration objects" do
|
@@ -31,10 +31,10 @@ describe Loquacious do
|
|
31
31
|
copy.first = 'foobar'
|
32
32
|
copy.second.bar = 'buz'
|
33
33
|
|
34
|
-
obj.first.should == 'foo'
|
35
|
-
obj.second.bar.should == 'baz'
|
36
|
-
copy.first.should == 'foobar'
|
37
|
-
copy.second.bar.should == 'buz'
|
34
|
+
obj.first.should be == 'foo'
|
35
|
+
obj.second.bar.should be == 'baz'
|
36
|
+
copy.first.should be == 'foobar'
|
37
|
+
copy.second.bar.should be == 'buz'
|
38
38
|
end
|
39
39
|
|
40
40
|
it "looks up a configuration object by name" do
|
@@ -46,8 +46,8 @@ describe Loquacious do
|
|
46
46
|
}
|
47
47
|
|
48
48
|
copy = Loquacious.copy('by name')
|
49
|
-
copy.first.should == 'foo'
|
50
|
-
copy.second.bar.should == 'baz'
|
49
|
+
copy.first.should be == 'foo'
|
50
|
+
copy.second.bar.should be == 'baz'
|
51
51
|
end
|
52
52
|
|
53
53
|
it "returns nil when a configuration object cannot be found" do
|
@@ -67,9 +67,9 @@ describe Loquacious do
|
|
67
67
|
third "hey I'm new"
|
68
68
|
}
|
69
69
|
|
70
|
-
copy.first.should == 'foo'
|
71
|
-
copy.second.bar.should == 'foobar'
|
72
|
-
copy.third.should == "hey I'm new"
|
70
|
+
copy.first.should be == 'foo'
|
71
|
+
copy.second.bar.should be == 'foobar'
|
72
|
+
copy.third.should be == "hey I'm new"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/spec/string_spec.rb
CHANGED
@@ -4,29 +4,29 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
4
4
|
describe String do
|
5
5
|
|
6
6
|
it "reduces to a size by replacing characters from the middle" do
|
7
|
-
"this is a longish string".reduce(10).should == "this...ing"
|
8
|
-
"this is a longish string".reduce(15).should == "this i...string"
|
9
|
-
"this is a longish string".reduce(24).should == "this is a longish string"
|
7
|
+
"this is a longish string".reduce(10).should be == "this...ing"
|
8
|
+
"this is a longish string".reduce(15).should be == "this i...string"
|
9
|
+
"this is a longish string".reduce(24).should be == "this is a longish string"
|
10
10
|
|
11
|
-
"this is a longish string".reduce(10, '--').should == "this--ring"
|
11
|
+
"this is a longish string".reduce(10, '--').should be == "this--ring"
|
12
12
|
end
|
13
13
|
|
14
14
|
it "indents by a given number of spaces" do
|
15
|
-
"hello".indent(2).should == " hello"
|
16
|
-
"hello\nworld".indent(4).should == " hello\n world"
|
17
|
-
" a\nslightly\n longer\n string\n".indent(2).should == " a\n slightly\n longer\n string\n "
|
15
|
+
"hello".indent(2).should be == " hello"
|
16
|
+
"hello\nworld".indent(4).should be == " hello\n world"
|
17
|
+
" a\nslightly\n longer\n string\n".indent(2).should be == " a\n slightly\n longer\n string\n "
|
18
18
|
end
|
19
19
|
|
20
20
|
it "indents using a leader string" do
|
21
|
-
"hello".indent("foo ").should == "foo hello"
|
22
|
-
"hello\nworld".indent("...").should == "...hello\n...world"
|
23
|
-
" a\nslightly\n longer\n string\n".indent("#").should == "# a\n#slightly\n# longer\n# string\n#"
|
21
|
+
"hello".indent("foo ").should be == "foo hello"
|
22
|
+
"hello\nworld".indent("...").should be == "...hello\n...world"
|
23
|
+
" a\nslightly\n longer\n string\n".indent("#").should be == "# a\n#slightly\n# longer\n# string\n#"
|
24
24
|
end
|
25
25
|
|
26
26
|
it "removes a leading gutter from all lines" do
|
27
27
|
str = " | foo"
|
28
28
|
result = str.gutter!
|
29
|
-
result.should == " foo"
|
29
|
+
result.should be == " foo"
|
30
30
|
result.should equal(str)
|
31
31
|
|
32
32
|
str = <<-STRING
|
@@ -39,13 +39,13 @@ describe String do
|
|
39
39
|
STRING
|
40
40
|
|
41
41
|
str.gutter!
|
42
|
-
str.should == " And this is where gutters really shine!\n HERE DOCS!!\n|they are the best\n\n You can indent stuff nicely and all that\nall done now\n"
|
42
|
+
str.should be == " And this is where gutters really shine!\n HERE DOCS!!\n|they are the best\n\n You can indent stuff nicely and all that\nall done now\n"
|
43
43
|
end
|
44
44
|
|
45
45
|
it "creates a copy when removing a leading gutter" do
|
46
46
|
str = " | foo"
|
47
47
|
result = str.gutter
|
48
|
-
result.should == " foo"
|
48
|
+
result.should be == " foo"
|
49
49
|
result.should_not equal(str)
|
50
50
|
end
|
51
51
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.9.0
|
metadata
CHANGED
@@ -1,91 +1,50 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: loquacious
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 8
|
9
|
-
- 1
|
10
|
-
version: 1.8.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.9.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Tim Pease
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-13 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rspec
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2161298080 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 6
|
33
|
-
version: "2.6"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.6'
|
34
22
|
type: :development
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
Kernel.load 'config/app.rb'
|
55
|
-
|
56
|
-
The attributes and their descriptions can be printed by using a Help object
|
57
|
-
|
58
|
-
help = Loquacious.help_for('app')
|
59
|
-
help.show :values => true # show the values for the attributes, too
|
60
|
-
|
61
|
-
Descriptions are optional, and configurations can be nested arbitrarily deep.
|
62
|
-
|
63
|
-
Loquacious.configuration_for('nested') {
|
64
|
-
desc "The outermost level"
|
65
|
-
a {
|
66
|
-
desc "One more level in"
|
67
|
-
b {
|
68
|
-
desc "Finally, a real value"
|
69
|
-
c 'value'
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
config = Loquacious.configuration_for('nested')
|
75
|
-
|
76
|
-
p config.a.b.c #=> "value"
|
77
|
-
|
78
|
-
And as you can see, descriptions can either be given inline after the value or
|
79
|
-
they can appear above the attribute and value on their own line.
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2161298080
|
25
|
+
description: ! "Descriptive configuration files for Ruby written in Ruby.\n\nLoquacious
|
26
|
+
provides a very open configuration system written in ruby and\ndescriptions for
|
27
|
+
each configuration attribute. The attributes and descriptions\ncan be iterated over
|
28
|
+
allowing for helpful information about those attributes to\nbe displayed to the
|
29
|
+
user.\n\nIn the simple case we have a file something like\n\n Loquacious.configuration_for('app')
|
30
|
+
{\n name 'value', :desc => \"Defines the name\"\n foo 'bar', :desc => \"FooBar\"\n
|
31
|
+
\ id 42, :desc => \"Ara T. Howard\"\n }\n\nWhich can be loaded via the
|
32
|
+
standard Ruby loading mechanisms\n\n Kernel.load 'config/app.rb'\n\nThe attributes
|
33
|
+
and their descriptions can be printed by using a Help object\n\n help = Loquacious.help_for('app')\n
|
34
|
+
\ help.show :values => true # show the values for the attributes, too\n\nDescriptions
|
35
|
+
are optional, and configurations can be nested arbitrarily deep.\n\n Loquacious.configuration_for('nested')
|
36
|
+
{\n desc \"The outermost level\"\n a {\n desc \"One more level in\"\n
|
37
|
+
\ b {\n desc \"Finally, a real value\"\n c 'value'\n }\n
|
38
|
+
\ }\n }\n\n config = Loquacious.configuration_for('nested')\n\n p config.a.b.c
|
39
|
+
\ #=> \"value\"\n\nAnd as you can see, descriptions can either be given inline after
|
40
|
+
the value or\nthey can appear above the attribute and value on their own line."
|
80
41
|
email: tim.pease@gmail.com
|
81
42
|
executables: []
|
82
|
-
|
83
43
|
extensions: []
|
84
|
-
|
85
|
-
extra_rdoc_files:
|
44
|
+
extra_rdoc_files:
|
86
45
|
- History.txt
|
87
46
|
- README.rdoc
|
88
|
-
files:
|
47
|
+
files:
|
89
48
|
- History.txt
|
90
49
|
- README.rdoc
|
91
50
|
- Rakefile
|
@@ -105,42 +64,31 @@ files:
|
|
105
64
|
- spec/spec.opts
|
106
65
|
- spec/spec_helper.rb
|
107
66
|
- spec/string_spec.rb
|
108
|
-
- tmp.rb
|
109
67
|
- version.txt
|
110
|
-
has_rdoc: true
|
111
68
|
homepage: http://rubygems.org/gems/loquacious
|
112
69
|
licenses: []
|
113
|
-
|
114
70
|
post_install_message:
|
115
|
-
rdoc_options:
|
71
|
+
rdoc_options:
|
116
72
|
- --main
|
117
73
|
- README.rdoc
|
118
|
-
require_paths:
|
74
|
+
require_paths:
|
119
75
|
- lib
|
120
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
77
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
126
|
-
|
127
|
-
- 0
|
128
|
-
version: "0"
|
129
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
83
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
|
135
|
-
segments:
|
136
|
-
- 0
|
137
|
-
version: "0"
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
138
88
|
requirements: []
|
139
|
-
|
140
89
|
rubyforge_project: loquacious
|
141
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.8.6
|
142
91
|
signing_key:
|
143
92
|
specification_version: 3
|
144
93
|
summary: Descriptive configuration files for Ruby written in Ruby.
|
145
94
|
test_files: []
|
146
|
-
|
data/tmp.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift 'lib'
|
4
|
-
require 'loquacious'
|
5
|
-
|
6
|
-
config = Loquacious.configuration_for('test') {}
|
7
|
-
|
8
|
-
Loquacious.defaults_for('test') {
|
9
|
-
bar(Proc.new { config.foo + '.bar' })
|
10
|
-
foo 'foo'
|
11
|
-
}
|
12
|
-
|
13
|
-
$stdout.puts "foo => #{config.foo}"
|
14
|
-
$stdout.puts "bar => #{config.bar}"
|
15
|
-
|