onering-client 0.1.6 → 0.1.7
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/lib/onering/config.rb +5 -2
- data/lib/onering/plugins/reporter.rb +7 -5
- data/lib/onering.rb +1 -1
- metadata +1 -1
data/lib/onering/config.rb
CHANGED
@@ -27,9 +27,12 @@ module Onering
|
|
27
27
|
# only load files we haven't seen before
|
28
28
|
(@_configfiles - @_configfiles_seen.to_a).each do |i|
|
29
29
|
c = YAML.load(File.read(File.expand_path(i))) rescue {}
|
30
|
-
|
30
|
+
|
31
|
+
if c and not c.empty?
|
32
|
+
Onering::Logger.info("Loading config file at #{File.expand_path(i) rescue i}", "Onering::Config")
|
33
|
+
@_config.deep_merge!(c)
|
34
|
+
end
|
31
35
|
|
32
|
-
@_config.deep_merge!(c)
|
33
36
|
@_configfiles_seen << i
|
34
37
|
end
|
35
38
|
|
@@ -213,10 +213,12 @@ module Onering
|
|
213
213
|
cache = _update_cache_file(cachefile)
|
214
214
|
end
|
215
215
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
216
|
+
if cache
|
217
|
+
# remove cached_at key
|
218
|
+
Onering::Logger.debug("Using cached data (#{Time.now.to_i - Time.parse(cache.get('cached_at')).to_i} seconds old)", "Onering::Reporter")
|
219
|
+
cache.delete('cached_at')
|
220
|
+
return cache
|
221
|
+
end
|
220
222
|
else
|
221
223
|
Onering::Logger.debug("Report cache file could not be read at #{cachefile}", "Onering::Reporter")
|
222
224
|
throw :retry if _update_cache_file(cachefile)
|
@@ -230,7 +232,7 @@ module Onering
|
|
230
232
|
def _update_cache_file(cachefile=DEFAULT_CACHE_FILE)
|
231
233
|
begin
|
232
234
|
report = nil
|
233
|
-
|
235
|
+
|
234
236
|
File.open(cachefile, 'w+') do |file|
|
235
237
|
Onering::Logger.debug("Regenerating cache file at #{cachefile}", "Onering::Reporter")
|
236
238
|
report = _generated_report()
|
data/lib/onering.rb
CHANGED