iqeo-conf 0.0.8 → 0.0.9
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/Gemfile.lock +1 -1
- data/lib/iqeo/configuration/version.rb +1 -1
- data/lib/iqeo/configuration.rb +2 -2
- data/pkg/iqeo-conf-0.0.8.gem +0 -0
- data/spec/configuration_spec.rb +54 -0
- metadata +4 -3
data/Gemfile.lock
CHANGED
data/lib/iqeo/configuration.rb
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
require_relative "configuration/version"
|
|
3
3
|
require_relative "configuration/hash_with_indifferent_access"
|
|
4
4
|
|
|
5
|
-
# fix: nested configurations broken for DSL !!
|
|
6
|
-
# todo: clean DSL syntax for creating a configuration - just a block ?
|
|
7
5
|
# todo: configuration file load path - array of Dir.glob like file specs ?
|
|
8
6
|
# todo: use an existing configuration for defaults
|
|
9
7
|
# todo: load configurations from a string or file after creation / in DSL block
|
|
@@ -84,12 +82,14 @@ module Iqeo
|
|
|
84
82
|
end
|
|
85
83
|
@items[key] = value
|
|
86
84
|
end
|
|
85
|
+
alias []= _set
|
|
87
86
|
|
|
88
87
|
def _get key
|
|
89
88
|
return @items[key] unless @items[key].nil?
|
|
90
89
|
return @items[key] if _parent.nil?
|
|
91
90
|
return _parent._get key
|
|
92
91
|
end
|
|
92
|
+
alias [] _get
|
|
93
93
|
|
|
94
94
|
end
|
|
95
95
|
|
|
Binary file
|
data/spec/configuration_spec.rb
CHANGED
|
@@ -530,6 +530,60 @@ describe Configuration do
|
|
|
530
530
|
conf.hotel.should be_true
|
|
531
531
|
end
|
|
532
532
|
|
|
533
|
+
it 'dynamic setting name can be a local' do
|
|
534
|
+
conf = nil
|
|
535
|
+
expect do
|
|
536
|
+
conf = Configuration.new do
|
|
537
|
+
alpha true
|
|
538
|
+
local1 = 'bravo'
|
|
539
|
+
self[local1] = true
|
|
540
|
+
local2 = 'charlie'
|
|
541
|
+
self[local2] = true
|
|
542
|
+
end
|
|
543
|
+
end.to_not raise_error
|
|
544
|
+
conf.should_not be_nil
|
|
545
|
+
conf.alpha.should be_true
|
|
546
|
+
conf.bravo.should be_true
|
|
547
|
+
conf.charlie.should be_true
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
it 'dynamic setting name can be a setting' do
|
|
551
|
+
conf = nil
|
|
552
|
+
expect do
|
|
553
|
+
conf = Configuration.new do
|
|
554
|
+
alpha true
|
|
555
|
+
setting1 'bravo'
|
|
556
|
+
self[setting1] = true
|
|
557
|
+
setting2 'charlie'
|
|
558
|
+
self[setting2] = true
|
|
559
|
+
end
|
|
560
|
+
end.to_not raise_error
|
|
561
|
+
conf.should_not be_nil
|
|
562
|
+
conf.alpha.should be_true
|
|
563
|
+
conf.bravo.should be_true
|
|
564
|
+
conf.charlie.should be_true
|
|
565
|
+
conf.setting1.should == 'bravo'
|
|
566
|
+
conf.setting2.should == 'charlie'
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
it 'dynamic setting can reference a nested configuration' do
|
|
570
|
+
conf = nil
|
|
571
|
+
expect do
|
|
572
|
+
conf = Configuration.new do
|
|
573
|
+
alpha true
|
|
574
|
+
local = :bravo
|
|
575
|
+
self[local] = Configuration.new do
|
|
576
|
+
charlie true
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
end.to_not raise_error
|
|
580
|
+
conf.should_not be_nil
|
|
581
|
+
conf.alpha.should be_true
|
|
582
|
+
conf.bravo.should be_a Configuration
|
|
583
|
+
conf.bravo.alpha should be_true
|
|
584
|
+
conf.bravo.charlie should be_true
|
|
585
|
+
end
|
|
586
|
+
|
|
533
587
|
end # instance_eval DSL
|
|
534
588
|
|
|
535
589
|
end # mode of usage
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iqeo-conf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-05-
|
|
12
|
+
date: 2012-05-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- pkg/iqeo-conf-0.0.5.gem
|
|
71
71
|
- pkg/iqeo-conf-0.0.6.gem
|
|
72
72
|
- pkg/iqeo-conf-0.0.7.gem
|
|
73
|
+
- pkg/iqeo-conf-0.0.8.gem
|
|
73
74
|
- spec/configuration_spec.rb
|
|
74
75
|
- spec/spec_helper.rb
|
|
75
76
|
homepage: http://iqeo.github.com/iqeo-conf
|
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
92
93
|
version: '0'
|
|
93
94
|
requirements: []
|
|
94
95
|
rubyforge_project:
|
|
95
|
-
rubygems_version: 1.8.
|
|
96
|
+
rubygems_version: 1.8.24
|
|
96
97
|
signing_key:
|
|
97
98
|
specification_version: 3
|
|
98
99
|
summary: A DSL for writing configuration files
|