collapsium-config 0.1.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 +7 -0
- data/.codeclimate.yml +34 -0
- data/.gitignore +39 -0
- data/.rspec +2 -0
- data/.rubocop.yml +75 -0
- data/.travis.yml +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +64 -0
- data/LICENSE +30 -0
- data/README.md +35 -0
- data/Rakefile +25 -0
- data/collapsium-config.gemspec +49 -0
- data/lib/collapsium-config.rb +51 -0
- data/lib/collapsium-config/configuration.rb +360 -0
- data/lib/collapsium-config/version.rb +14 -0
- data/spec/configuration_spec.rb +183 -0
- data/spec/data/array.yaml +3 -0
- data/spec/data/driverconfig.yml +26 -0
- data/spec/data/empty.yml +1 -0
- data/spec/data/extend.yml +6 -0
- data/spec/data/global.yml +2 -0
- data/spec/data/hash.yml +3 -0
- data/spec/data/include-extend.yml +7 -0
- data/spec/data/include-multiple.yml +5 -0
- data/spec/data/include-recursive.yml +3 -0
- data/spec/data/include-simple.yml +3 -0
- data/spec/data/include1.yml +2 -0
- data/spec/data/include2.json +3 -0
- data/spec/data/merge-array-local.yaml +2 -0
- data/spec/data/merge-array.yaml +3 -0
- data/spec/data/merge-fail-local.yaml +2 -0
- data/spec/data/merge-fail.yaml +5 -0
- data/spec/data/merge-hash-local.yml +4 -0
- data/spec/data/merge-hash.yml +7 -0
- data/spec/data/recurse.yml +4 -0
- data/spec/data/recursive.yml +3 -0
- data/spec/data/test.json +4 -0
- data/spec/module_spec.rb +25 -0
- data/spec/spec_helper.rb +9 -0
- metadata +207 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# the hierarchy is mock -> branch1 -> branch2 -> leaf
|
|
2
|
+
#
|
|
3
|
+
# We test
|
|
4
|
+
# a) having a base before its derived by ordering mock before branch1
|
|
5
|
+
# b) having a base after its derived by ordering branch2 after leaf
|
|
6
|
+
# c) overrides by having leaf override the option from branch1
|
|
7
|
+
#
|
|
8
|
+
# so the order in this file has to be mock -> branch2 -> branch1 -> leaf
|
|
9
|
+
---
|
|
10
|
+
drivers:
|
|
11
|
+
mock:
|
|
12
|
+
mockoption: 42
|
|
13
|
+
branch2:
|
|
14
|
+
extends: branch1
|
|
15
|
+
branch2option: bar
|
|
16
|
+
branch1:
|
|
17
|
+
extends: mock
|
|
18
|
+
branch1option: foo
|
|
19
|
+
leaf:
|
|
20
|
+
extends: branch2
|
|
21
|
+
leafoption: baz
|
|
22
|
+
branch1option: override
|
|
23
|
+
base_does_not_exist:
|
|
24
|
+
extends: nonexistent_base
|
|
25
|
+
some: value
|
|
26
|
+
driver: leaf
|
data/spec/data/empty.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
---
|
data/spec/data/hash.yml
ADDED
data/spec/data/test.json
ADDED
data/spec/module_spec.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require_relative '../lib/collapsium-config'
|
|
3
|
+
|
|
4
|
+
include Collapsium::Config
|
|
5
|
+
|
|
6
|
+
describe Collapsium::Config do
|
|
7
|
+
before do
|
|
8
|
+
@data_path = File.join(File.dirname(__FILE__), 'data')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "fails to load configuration from the default path (it does not exist)" do
|
|
12
|
+
expect(config.empty?).to be_truthy
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "fails to load configuration files of unrecognized formats" do
|
|
16
|
+
Collapsium::Config.config_file = File.join(@data_path, 'foo.bar')
|
|
17
|
+
expect { config.empty? }.to raise_error(ArgumentError)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "loads configuration from an existing path" do
|
|
21
|
+
Collapsium::Config.config_file = File.join(@data_path, 'global.yml')
|
|
22
|
+
expect { config.empty? }.not_to raise_error(ArgumentError)
|
|
23
|
+
expect(config.empty?).to be_falsy
|
|
24
|
+
end
|
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: collapsium-config
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jens Finkhaeuser
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rubocop
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.40'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.40'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '11.1'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '11.1'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.4'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.4'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: simplecov
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0.11'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0.11'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: yard
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.8'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.8'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: collapsium
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0.1'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0.1'
|
|
111
|
+
description: "\n Using collapsium's UberHash class for easy access to configuration
|
|
112
|
+
values,\n this gem reads and merges various configuration sources into one\n
|
|
113
|
+
\ configuration object.\n "
|
|
114
|
+
email:
|
|
115
|
+
- jens@finkhaeuser.de
|
|
116
|
+
executables: []
|
|
117
|
+
extensions: []
|
|
118
|
+
extra_rdoc_files: []
|
|
119
|
+
files:
|
|
120
|
+
- ".codeclimate.yml"
|
|
121
|
+
- ".gitignore"
|
|
122
|
+
- ".rspec"
|
|
123
|
+
- ".rubocop.yml"
|
|
124
|
+
- ".travis.yml"
|
|
125
|
+
- Gemfile
|
|
126
|
+
- Gemfile.lock
|
|
127
|
+
- LICENSE
|
|
128
|
+
- README.md
|
|
129
|
+
- Rakefile
|
|
130
|
+
- collapsium-config.gemspec
|
|
131
|
+
- lib/collapsium-config.rb
|
|
132
|
+
- lib/collapsium-config/configuration.rb
|
|
133
|
+
- lib/collapsium-config/version.rb
|
|
134
|
+
- spec/configuration_spec.rb
|
|
135
|
+
- spec/data/array.yaml
|
|
136
|
+
- spec/data/driverconfig.yml
|
|
137
|
+
- spec/data/empty.yml
|
|
138
|
+
- spec/data/extend.yml
|
|
139
|
+
- spec/data/global.yml
|
|
140
|
+
- spec/data/hash.yml
|
|
141
|
+
- spec/data/include-extend.yml
|
|
142
|
+
- spec/data/include-multiple.yml
|
|
143
|
+
- spec/data/include-recursive.yml
|
|
144
|
+
- spec/data/include-simple.yml
|
|
145
|
+
- spec/data/include1.yml
|
|
146
|
+
- spec/data/include2.json
|
|
147
|
+
- spec/data/merge-array-local.yaml
|
|
148
|
+
- spec/data/merge-array.yaml
|
|
149
|
+
- spec/data/merge-fail-local.yaml
|
|
150
|
+
- spec/data/merge-fail.yaml
|
|
151
|
+
- spec/data/merge-hash-local.yml
|
|
152
|
+
- spec/data/merge-hash.yml
|
|
153
|
+
- spec/data/recurse.yml
|
|
154
|
+
- spec/data/recursive.yml
|
|
155
|
+
- spec/data/test.json
|
|
156
|
+
- spec/module_spec.rb
|
|
157
|
+
- spec/spec_helper.rb
|
|
158
|
+
homepage: https://github.com/jfinkhaeuser/collapsium-config
|
|
159
|
+
licenses:
|
|
160
|
+
- MITNFA
|
|
161
|
+
metadata: {}
|
|
162
|
+
post_install_message:
|
|
163
|
+
rdoc_options: []
|
|
164
|
+
require_paths:
|
|
165
|
+
- lib
|
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
|
+
requirements:
|
|
168
|
+
- - ">="
|
|
169
|
+
- !ruby/object:Gem::Version
|
|
170
|
+
version: '2.0'
|
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
|
+
requirements:
|
|
173
|
+
- - ">="
|
|
174
|
+
- !ruby/object:Gem::Version
|
|
175
|
+
version: '0'
|
|
176
|
+
requirements: []
|
|
177
|
+
rubyforge_project:
|
|
178
|
+
rubygems_version: 2.4.5.1
|
|
179
|
+
signing_key:
|
|
180
|
+
specification_version: 4
|
|
181
|
+
summary: Collapse multiple configuration sources into one collapsium UberHash.
|
|
182
|
+
test_files:
|
|
183
|
+
- spec/configuration_spec.rb
|
|
184
|
+
- spec/data/array.yaml
|
|
185
|
+
- spec/data/driverconfig.yml
|
|
186
|
+
- spec/data/empty.yml
|
|
187
|
+
- spec/data/extend.yml
|
|
188
|
+
- spec/data/global.yml
|
|
189
|
+
- spec/data/hash.yml
|
|
190
|
+
- spec/data/include-extend.yml
|
|
191
|
+
- spec/data/include-multiple.yml
|
|
192
|
+
- spec/data/include-recursive.yml
|
|
193
|
+
- spec/data/include-simple.yml
|
|
194
|
+
- spec/data/include1.yml
|
|
195
|
+
- spec/data/include2.json
|
|
196
|
+
- spec/data/merge-array-local.yaml
|
|
197
|
+
- spec/data/merge-array.yaml
|
|
198
|
+
- spec/data/merge-fail-local.yaml
|
|
199
|
+
- spec/data/merge-fail.yaml
|
|
200
|
+
- spec/data/merge-hash-local.yml
|
|
201
|
+
- spec/data/merge-hash.yml
|
|
202
|
+
- spec/data/recurse.yml
|
|
203
|
+
- spec/data/recursive.yml
|
|
204
|
+
- spec/data/test.json
|
|
205
|
+
- spec/module_spec.rb
|
|
206
|
+
- spec/spec_helper.rb
|
|
207
|
+
has_rdoc:
|