coral_core 0.2.24 → 0.2.25
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/coral_core.gemspec +2 -2
- data/lib/coral_core/config.rb +20 -9
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.25
|
data/coral_core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "coral_core"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.25"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Adrian Webb"]
|
12
|
-
s.date = "2013-05-
|
12
|
+
s.date = "2013-05-22"
|
13
13
|
s.description = "= coral_core\n\nThis library provides core data elements and utilities used in other Coral gems.\n\nThe Coral core library contains functionality that is utilized by other\nCoral gems by providing basic utilities like Git, Shell, Disk, and Data\nmanipulation libraries, a UI system, and a core data model that supports\nEvents, Commands, Repositories, and Memory (version controlled JSON \nobjects). This library is only used as a starting point for other systems.\n\nNote: This library is still very early in development!\n\n== Contributing to coral_core\n \n* Check out the latest {major}.{minor} branch to make sure the feature hasn't \n been implemented or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested \n it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Make sure to add tests for it. This is important so I don't break it in a \n future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want \n to have your own version, or is otherwise necessary, that is fine, but \n please isolate to its own commit so I can cherry-pick around it.\n\n== Copyright\n\nLicensed under GPLv3. See LICENSE.txt for further details.\n\nCopyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>\nCoral Technology Group LLC"
|
14
14
|
s.email = "adrian.webb@coraltech.net"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/coral_core/config.rb
CHANGED
@@ -74,8 +74,10 @@ class Config
|
|
74
74
|
unless Util::Data.empty?(log_options['config_log'])
|
75
75
|
config_log = log_options['config_log']
|
76
76
|
|
77
|
-
|
78
|
-
|
77
|
+
if log_options['config_store']
|
78
|
+
Util::Disk.write(config_log, JSON.pretty_generate(@@properties))
|
79
|
+
Util::Disk.close(config_log)
|
80
|
+
end
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
@@ -158,17 +160,19 @@ class Config
|
|
158
160
|
prefix = config.get(:prefix, true)
|
159
161
|
prefix_text = prefix ? sep : ''
|
160
162
|
|
163
|
+
debug = config.get(:debug, false)
|
164
|
+
|
161
165
|
search_name = config.get(:search_name, true)
|
162
166
|
reverse_lookup = config.get(:reverse_lookup, true)
|
163
167
|
|
164
|
-
|
168
|
+
dbg(default, "lookup -> #{name}") if debug
|
165
169
|
|
166
170
|
if Config.initialized?(options)
|
167
171
|
unless scope.respond_to?("[]")
|
168
172
|
scope = Hiera::Scope.new(scope)
|
169
173
|
end
|
170
|
-
value = hiera.lookup(name,
|
171
|
-
|
174
|
+
value = hiera.lookup(name, nil, scope, override, context)
|
175
|
+
dbg(value, "hiera lookup -> #{name}") if debug
|
172
176
|
end
|
173
177
|
|
174
178
|
if Util::Data.undef?(value) && ( scope.respond_to?("[]") || scope.respond_to?("lookupvar") )
|
@@ -181,14 +185,14 @@ class Config
|
|
181
185
|
end
|
182
186
|
base_names = base_names.reverse if reverse_lookup
|
183
187
|
|
184
|
-
|
188
|
+
dbg(base_names, 'lookup search path') if debug
|
185
189
|
base_names.each do |item|
|
186
190
|
if scope.respond_to?("lookupvar")
|
187
191
|
value = scope.lookupvar("#{prefix_text}#{item}#{sep}#{name}")
|
188
192
|
else
|
189
193
|
value = scope["#{prefix_text}#{item}#{sep}#{name}"]
|
190
194
|
end
|
191
|
-
|
195
|
+
dbg(value, "scope lookup #{prefix_text}#{item}#{sep}#{name}") if debug
|
192
196
|
break unless Util::Data.undef?(value)
|
193
197
|
end
|
194
198
|
end
|
@@ -198,7 +202,7 @@ class Config
|
|
198
202
|
else
|
199
203
|
value = scope["#{prefix_text}#{name}"]
|
200
204
|
end
|
201
|
-
|
205
|
+
dbg(value, "scope lookup #{prefix_text}#{name}") if debug
|
202
206
|
end
|
203
207
|
Puppet::Util::Log.level = log_level
|
204
208
|
end
|
@@ -209,7 +213,7 @@ class Config
|
|
209
213
|
set_property(name, value)
|
210
214
|
end
|
211
215
|
|
212
|
-
|
216
|
+
dbg(value, "lookup result -> #{name}") if debug
|
213
217
|
return value
|
214
218
|
end
|
215
219
|
|
@@ -219,6 +223,8 @@ class Config
|
|
219
223
|
config = Config.ensure(options)
|
220
224
|
results = {}
|
221
225
|
|
226
|
+
debug = config.get(:debug, false)
|
227
|
+
|
222
228
|
unless Util::Data.undef?(override)
|
223
229
|
case data
|
224
230
|
when String, Symbol
|
@@ -230,6 +236,9 @@ class Config
|
|
230
236
|
end
|
231
237
|
end
|
232
238
|
|
239
|
+
dbg(data, 'config normalize data') if debug
|
240
|
+
dbg(override, 'config normalize override') if debug
|
241
|
+
|
233
242
|
case data
|
234
243
|
when String, Symbol
|
235
244
|
results = Config.lookup(data.to_s, {}, config)
|
@@ -248,6 +257,8 @@ class Config
|
|
248
257
|
results = data
|
249
258
|
end
|
250
259
|
|
260
|
+
dbg(results, 'config normalize results') if debug
|
261
|
+
|
251
262
|
return results
|
252
263
|
end
|
253
264
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coral_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 37
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 25
|
10
|
+
version: 0.2.25
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adrian Webb
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-05-
|
18
|
+
date: 2013-05-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: log4r
|