loquacious 1.9.0 → 1.9.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/.gitignore +16 -0
- data/History.txt +5 -0
- data/lib/loquacious/configuration.rb +1 -1
- data/spec/configuration_spec.rb +76 -73
- data/spec/help_spec.rb +2 -3
- data/spec/loquacious_spec.rb +10 -10
- data/version.txt +1 -1
- metadata +6 -6
- data/spec/spec.opts +0 -1
data/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# The list of files that should be ignored by Mr Bones.
|
2
|
+
# Lines that start with '#' are comments.
|
3
|
+
#
|
4
|
+
# A .gitignore file can be used instead by setting it as the ignore
|
5
|
+
# file in your Rakefile:
|
6
|
+
#
|
7
|
+
# PROJ.ignore_file = '.gitignore'
|
8
|
+
#
|
9
|
+
# For a project with a C extension, the following would be a good set of
|
10
|
+
# exclude patterns (uncomment them if you want to use them):
|
11
|
+
# *.[oa]
|
12
|
+
# *~
|
13
|
+
announcement.txt
|
14
|
+
coverage
|
15
|
+
doc
|
16
|
+
pkg
|
data/History.txt
CHANGED
@@ -231,7 +231,7 @@ module Loquacious
|
|
231
231
|
if value.kind_of?(Configuration) and other_value.kind_of?(Configuration)
|
232
232
|
value.merge! other_value
|
233
233
|
elsif !other_value.kind_of?(Loquacious::Undefined)
|
234
|
-
|
234
|
+
self.__send__(key, other_value)
|
235
235
|
end
|
236
236
|
|
237
237
|
if other_defaults.has_key? key
|
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.
|
15
|
-
obj.second.
|
16
|
-
obj.third.should
|
14
|
+
obj.first.eql?('foo').should be_true
|
15
|
+
obj.second.eql?('bar').should be_true
|
16
|
+
obj.third.kind_of?(Loquacious::Undefined).should be_true
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should respond to any method' do
|
20
|
-
@obj.first.should
|
20
|
+
@obj.first.kind_of?(Loquacious::Undefined).should be_true
|
21
21
|
@obj.first = 'foo'
|
22
|
-
@obj.first.
|
22
|
+
@obj.first.eql?('foo').should be_true
|
23
23
|
|
24
24
|
@obj.second = 'bar'
|
25
|
-
@obj.second.
|
25
|
+
@obj.second.eql?('bar').should be_true
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should deine attribute accessors when first used' do
|
29
|
-
@obj.respond_to?(:foo).should
|
30
|
-
@obj.respond_to?(:foo=).should
|
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
|
34
|
-
@obj.respond_to?(:foo=).should
|
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.
|
46
|
+
cfg.hash.eql?({:one => 1}).should be_true
|
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
|
57
|
-
cfg[:two].should
|
58
|
-
cfg['three'].should
|
56
|
+
cfg['one'].eql?(1).should be_true
|
57
|
+
cfg[:two].eql?(2).should be_true
|
58
|
+
cfg['three'].eql?(3).should be_true
|
59
59
|
|
60
|
-
cfg[:four].should
|
60
|
+
cfg[:four].kind_of?(Loquacious::Undefined).should be_true
|
61
61
|
cfg.four = 4
|
62
|
-
cfg[:four].should
|
62
|
+
cfg[:four].eql?(4).should be_true
|
63
63
|
|
64
64
|
cfg[:five] = 5
|
65
|
-
cfg.five.should
|
66
|
-
cfg[:five].should
|
65
|
+
cfg.five.eql?(5).should be_true
|
66
|
+
cfg[:five].eql?(5).should be_true
|
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'].
|
78
|
-
cfg['split'].
|
79
|
-
cfg['raise'].
|
80
|
-
cfg['puts'].
|
77
|
+
cfg['fork'].eql?('spoon knife spork').should be_true
|
78
|
+
cfg['split'].eql?('join').should be_true
|
79
|
+
cfg['raise'].eql?('double down').should be_true
|
80
|
+
cfg['puts'].eql?('not what you think').should be_true
|
81
81
|
|
82
|
-
cfg[:fork].
|
83
|
-
cfg[:split].
|
84
|
-
cfg[:raise].
|
85
|
-
cfg[:puts].
|
82
|
+
cfg[:fork].eql?('spoon knife spork').should be_true
|
83
|
+
cfg[:split].eql?('join').should be_true
|
84
|
+
cfg[:raise].eql?('double down').should be_true
|
85
|
+
cfg[:puts].eql?('not what you think').should be_true
|
86
86
|
|
87
|
-
cfg.fork.
|
88
|
-
cfg.split.
|
89
|
-
cfg.raise.
|
90
|
-
cfg.puts.
|
87
|
+
cfg.fork.eql?('spoon knife spork').should be_true
|
88
|
+
cfg.split.eql?('join').should be_true
|
89
|
+
cfg.raise.eql?('double down').should be_true
|
90
|
+
cfg.puts.eql?('not what you think').should be_true
|
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
|
102
|
-
cfg.foo.
|
103
|
-
cfg.baz.
|
101
|
+
cfg.timeout.eql?(10).should be_true
|
102
|
+
cfg.foo.eql?('bar').should be_true
|
103
|
+
cfg.baz.eql?('buz').should be_true
|
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.
|
113
|
+
obj.third.eql?('foobar').should be_true
|
114
114
|
|
115
115
|
obj.second = 'baz'
|
116
|
-
obj.third.
|
116
|
+
obj.third.eql?('foobaz').should be_true
|
117
117
|
|
118
118
|
obj.first = 'Hello '
|
119
119
|
obj.second = 'World!'
|
120
|
-
obj.third.
|
120
|
+
obj.third.eql?('Hello World!').should be_true
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'should return a value when evaluating inside the DSL' do
|
@@ -128,16 +128,16 @@ describe Loquacious::Configuration do
|
|
128
128
|
}
|
129
129
|
}
|
130
130
|
|
131
|
-
obj.first.
|
132
|
-
obj.second.bar.should
|
131
|
+
obj.first.eql?('foo').should be_true
|
132
|
+
obj.second.bar.eql?(nil).should be_true
|
133
133
|
|
134
134
|
Loquacious::Configuration::DSL.evaluate(:config => obj) {
|
135
135
|
first 'bar'
|
136
136
|
second.bar 'no longer nil'
|
137
137
|
}
|
138
138
|
|
139
|
-
obj.first.
|
140
|
-
obj.second.bar.
|
139
|
+
obj.first.eql?('bar').should be_true
|
140
|
+
obj.second.bar.eql?('no longer nil').should be_true
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'should not delete descriptions' do
|
@@ -150,8 +150,8 @@ describe Loquacious::Configuration do
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
153
|
-
obj.first.
|
154
|
-
obj.second.bar.should
|
153
|
+
obj.first.eql?('foo').should be_true
|
154
|
+
obj.second.bar.eql?(nil).should be_true
|
155
155
|
|
156
156
|
obj.__desc[:first].should be == 'the first value'
|
157
157
|
obj.__desc[:second].should be == 'the second value'
|
@@ -162,8 +162,8 @@ describe Loquacious::Configuration do
|
|
162
162
|
second.bar 'no longer nil'
|
163
163
|
}
|
164
164
|
|
165
|
-
obj.first.
|
166
|
-
obj.second.bar.
|
165
|
+
obj.first.eql?('bar').should be_true
|
166
|
+
obj.second.bar.eql?('no longer nil').should be_true
|
167
167
|
|
168
168
|
obj.__desc[:first].should be == 'the first value'
|
169
169
|
obj.__desc[:second].should be == 'the second value'
|
@@ -172,6 +172,9 @@ describe Loquacious::Configuration do
|
|
172
172
|
|
173
173
|
# -----------------------------------------------------------------------
|
174
174
|
describe 'when merging' do
|
175
|
+
before :each do
|
176
|
+
Loquacious::Configuration.instance_variable_get(:@table).clear
|
177
|
+
end
|
175
178
|
|
176
179
|
it 'should merge the contents of another Configuration' do
|
177
180
|
other = Loquacious::Configuration.new {
|
@@ -179,13 +182,13 @@ describe Loquacious::Configuration do
|
|
179
182
|
second 'bar', :desc => 'bar method'
|
180
183
|
}
|
181
184
|
|
182
|
-
@obj.first.should
|
183
|
-
@obj.second.should
|
185
|
+
@obj.first.kind_of?(Loquacious::Undefined).should be_true
|
186
|
+
@obj.second.kind_of?(Loquacious::Undefined).should be_true
|
184
187
|
@obj.__desc.should be == {:first => nil, :second => nil}
|
185
188
|
|
186
189
|
@obj.merge! other
|
187
|
-
@obj.first.
|
188
|
-
@obj.second.
|
190
|
+
@obj.first.eql?('foo').should be_true
|
191
|
+
@obj.second.eql?('bar').should be_true
|
189
192
|
@obj.__desc.should be == {
|
190
193
|
:first => 'foo method',
|
191
194
|
:second => 'bar method'
|
@@ -211,10 +214,10 @@ describe Loquacious::Configuration do
|
|
211
214
|
|
212
215
|
@obj.merge! other
|
213
216
|
|
214
|
-
@obj.first.
|
215
|
-
@obj.second.
|
216
|
-
@obj.third.question.
|
217
|
-
@obj.third.answer.should
|
217
|
+
@obj.first.eql?('foo').should be_true
|
218
|
+
@obj.second.eql?('bar').should be_true
|
219
|
+
@obj.third.question.eql?('?').should be_true
|
220
|
+
@obj.third.answer.eql?(42).should be_true
|
218
221
|
|
219
222
|
@obj.__desc.should be == {
|
220
223
|
:first => 'foo method',
|
@@ -289,14 +292,14 @@ describe Loquacious::Configuration do
|
|
289
292
|
}
|
290
293
|
|
291
294
|
c = Loquacious::Configuration.for 'test'
|
292
|
-
c.first.
|
293
|
-
c.second.bar.should
|
295
|
+
c.first.eql?('foo').should be_true
|
296
|
+
c.second.bar.eql?(nil).should be_true
|
294
297
|
end
|
295
298
|
|
296
299
|
it 'does not overwrite existing configuration values' do
|
297
300
|
c = Loquacious::Configuration.for('test') {
|
298
301
|
first 1
|
299
|
-
|
302
|
+
third 3
|
300
303
|
}
|
301
304
|
|
302
305
|
Loquacious::Configuration.defaults_for('test') {
|
@@ -307,14 +310,14 @@ describe Loquacious::Configuration do
|
|
307
310
|
}
|
308
311
|
}
|
309
312
|
|
310
|
-
c.first.should
|
311
|
-
c.third.should
|
312
|
-
c.second.bar.should
|
313
|
+
c.first.eql?(1).should be_true
|
314
|
+
c.third.eql?(3).should be_true
|
315
|
+
c.second.bar.eql?(nil).should be_true
|
313
316
|
|
314
317
|
c.__desc[:first].should be == 'the first value'
|
315
318
|
c.__desc[:second].should be == 'the second value'
|
316
319
|
c.second.__desc[:bar].should be == 'time to go drinking'
|
317
|
-
c.__desc[:
|
320
|
+
c.__desc[:third].should be_nil
|
318
321
|
end
|
319
322
|
|
320
323
|
it 'does not overwrite nested configuration values' do
|
@@ -327,7 +330,7 @@ describe Loquacious::Configuration do
|
|
327
330
|
boo 'who'
|
328
331
|
}
|
329
332
|
}
|
330
|
-
|
333
|
+
third 3
|
331
334
|
}
|
332
335
|
|
333
336
|
Loquacious::Configuration.defaults_for('test') {
|
@@ -343,14 +346,14 @@ describe Loquacious::Configuration do
|
|
343
346
|
}
|
344
347
|
}
|
345
348
|
|
346
|
-
c.first.should
|
347
|
-
c.third.should
|
348
|
-
c.second.bar.
|
349
|
-
c.second.baz.buz.
|
350
|
-
c.second.baz.boo.
|
349
|
+
c.first.eql?(1).should be_true
|
350
|
+
c.third.eql?(3).should be_true
|
351
|
+
c.second.bar.eql?('pub').should be_true
|
352
|
+
c.second.baz.buz.eql?('random text').should be_true
|
353
|
+
c.second.baz.boo.eql?('who').should be_true
|
351
354
|
|
352
355
|
c.second.bar = Loquacious::Undefined.new('second.bar')
|
353
|
-
c.second.bar.
|
356
|
+
c.second.bar.eql?('h-bar').should be_true
|
354
357
|
|
355
358
|
c.__desc[:first].should be == 'the first value'
|
356
359
|
c.__desc[:second].should be == 'the second value'
|
@@ -358,7 +361,7 @@ describe Loquacious::Configuration do
|
|
358
361
|
c.second.__desc[:baz].should be == 'getting weird'
|
359
362
|
c.second.baz.__desc[:buz].should be == 'post drinking feeling'
|
360
363
|
c.second.baz.__desc[:boo].should be == 'no need to cry about it'
|
361
|
-
c.__desc[:
|
364
|
+
c.__desc[:third].should be_nil
|
362
365
|
end
|
363
366
|
|
364
367
|
it 'supports differing default type' do
|
@@ -372,7 +375,7 @@ describe Loquacious::Configuration do
|
|
372
375
|
boo 'who'
|
373
376
|
}
|
374
377
|
}
|
375
|
-
|
378
|
+
third 3
|
376
379
|
}
|
377
380
|
|
378
381
|
Loquacious::Configuration.defaults_for('test') {
|
@@ -384,11 +387,11 @@ describe Loquacious::Configuration do
|
|
384
387
|
}
|
385
388
|
}
|
386
389
|
|
387
|
-
c.second.baz.buz.
|
388
|
-
c.second.baz.boo.
|
390
|
+
c.second.baz.buz.eql?('random text').should be_true
|
391
|
+
c.second.baz.boo.eql?('who').should be_true
|
389
392
|
|
390
393
|
c.second.baz = Loquacious::Undefined.new('second.bar')
|
391
|
-
c.second.baz.should
|
394
|
+
c.second.baz.eql?(nil).should be_true
|
392
395
|
c.second.__desc[:baz].should be == 'deprecated'
|
393
396
|
end
|
394
397
|
|
@@ -398,7 +401,7 @@ describe Loquacious::Configuration do
|
|
398
401
|
second {
|
399
402
|
bar 'pub'
|
400
403
|
}
|
401
|
-
|
404
|
+
third 3
|
402
405
|
}
|
403
406
|
|
404
407
|
Loquacious::Configuration.defaults_for('test') {
|
@@ -410,7 +413,7 @@ describe Loquacious::Configuration do
|
|
410
413
|
}
|
411
414
|
}
|
412
415
|
|
413
|
-
c.second.baz.should
|
416
|
+
c.second.baz.eql?(36).should be_true
|
414
417
|
c.second.__desc[:baz].should be == 'proc will be evaluated'
|
415
418
|
end
|
416
419
|
end
|
data/spec/help_spec.rb
CHANGED
@@ -16,13 +16,13 @@ describe Loquacious::Configuration::Help do
|
|
16
16
|
it "returns a help object by name" do
|
17
17
|
help = Loquacious::Configuration::Help.new 'specs'
|
18
18
|
config = help.instance_variable_get(:@config)
|
19
|
-
config.
|
19
|
+
config.equal?(@config).should be_true
|
20
20
|
end
|
21
21
|
|
22
22
|
it "returns a help object for a configuration" do
|
23
23
|
help = Loquacious::Configuration::Help.new @config
|
24
24
|
config = help.instance_variable_get(:@config)
|
25
|
-
config.
|
25
|
+
config.equal?(@config).should be_true
|
26
26
|
end
|
27
27
|
|
28
28
|
it "raises an error for invalid attribute names" do
|
@@ -356,4 +356,3 @@ describe Loquacious::Configuration::Help do
|
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
359
|
-
# EOF
|
data/spec/loquacious_spec.rb
CHANGED
@@ -31,10 +31,10 @@ describe Loquacious do
|
|
31
31
|
copy.first = 'foobar'
|
32
32
|
copy.second.bar = 'buz'
|
33
33
|
|
34
|
-
obj.first.
|
35
|
-
obj.second.bar.
|
36
|
-
copy.first.
|
37
|
-
copy.second.bar.
|
34
|
+
obj.first.eql?('foo').should be_true
|
35
|
+
obj.second.bar.eql?('baz').should be_true
|
36
|
+
copy.first.eql?('foobar').should be_true
|
37
|
+
copy.second.bar.eql?('buz').should be_true
|
38
38
|
end
|
39
39
|
|
40
40
|
it "looks up a configuration object by name" do
|
@@ -46,12 +46,12 @@ describe Loquacious do
|
|
46
46
|
}
|
47
47
|
|
48
48
|
copy = Loquacious.copy('by name')
|
49
|
-
copy.first.
|
50
|
-
copy.second.bar.
|
49
|
+
copy.first.eql?('foo').should be_true
|
50
|
+
copy.second.bar.eql?('baz').should be_true
|
51
51
|
end
|
52
52
|
|
53
53
|
it "returns nil when a configuration object cannot be found" do
|
54
|
-
Loquacious.copy('does not exist').should
|
54
|
+
Loquacious.copy('does not exist').eql?(nil).should be_true
|
55
55
|
end
|
56
56
|
|
57
57
|
it "overrides options with a block" do
|
@@ -67,9 +67,9 @@ describe Loquacious do
|
|
67
67
|
third "hey I'm new"
|
68
68
|
}
|
69
69
|
|
70
|
-
copy.first.
|
71
|
-
copy.second.bar.
|
72
|
-
copy.third.
|
70
|
+
copy.first.eql?('foo').should be_true
|
71
|
+
copy.second.bar.eql?('foobar').should be_true
|
72
|
+
copy.third.eql?("hey I'm new").should be_true
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loquacious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153879980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2.6'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153879980
|
25
25
|
description: ! "Descriptive configuration files for Ruby written in Ruby.\n\nLoquacious
|
26
26
|
provides a very open configuration system written in ruby and\ndescriptions for
|
27
27
|
each configuration attribute. The attributes and descriptions\ncan be iterated over
|
@@ -45,6 +45,7 @@ extra_rdoc_files:
|
|
45
45
|
- History.txt
|
46
46
|
- README.rdoc
|
47
47
|
files:
|
48
|
+
- .gitignore
|
48
49
|
- History.txt
|
49
50
|
- README.rdoc
|
50
51
|
- Rakefile
|
@@ -61,7 +62,6 @@ files:
|
|
61
62
|
- spec/help_spec.rb
|
62
63
|
- spec/iterator_spec.rb
|
63
64
|
- spec/loquacious_spec.rb
|
64
|
-
- spec/spec.opts
|
65
65
|
- spec/spec_helper.rb
|
66
66
|
- spec/string_spec.rb
|
67
67
|
- version.txt
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project: loquacious
|
90
|
-
rubygems_version: 1.8.
|
90
|
+
rubygems_version: 1.8.11
|
91
91
|
signing_key:
|
92
92
|
specification_version: 3
|
93
93
|
summary: Descriptive configuration files for Ruby written in Ruby.
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color --format specdoc
|