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.
@@ -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
- Onering::Logger.info("Loading config file at #{File.expand_path(i) rescue i}", "Onering::Config") unless c.empty?
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
- # remove cached_at key
217
- Onering::Logger.debug("Using cached data (#{Time.now.to_i - Time.parse(cache.get('cached_at')).to_i} seconds old)", "Onering::Reporter")
218
- cache.delete('cached_at')
219
- return cache
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
@@ -2,7 +2,7 @@ $: << File.expand_path(File.dirname(__FILE__))
2
2
 
3
3
  module Onering
4
4
  module Client
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.7"
6
6
 
7
7
  class Error < Exception; end
8
8
  class FatalError < Error; end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: onering-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.6
5
+ version: 0.1.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gary Hetzel