lib/onering/cli/reporter.rb in onering-client-0.1.4 vs lib/onering/cli/reporter.rb in onering-client-0.1.5
- old
+ new
@@ -41,11 +41,18 @@
:maxage => @opts[:maxage]
}.compact)
end
def self.run(args)
- report = _report()
+ # saving, by default, should not use the cache (but should update it to keep it fresh)
+ if @opts[:save] === true or args[0] == 'save'
+ report = _report({
+ :cacheregen => true
+ })
+ else
+ report = _report()
+ end
# pull overrides from CLI arguments
@opts[:fields].each do |field|
key, value = field.split('=', 2)
Onering::Logger.debug("Override value #{key} from command line argument", "Onering::CLI::Report")
@@ -96,13 +103,13 @@
@api.assets.save(report['id']) do
MultiJson.dump(report)
end
end
- def self._report()
+ def self._report(options={})
begin
Onering::Logger.debug("Gathering local data for report", "Onering::CLI::Report")
- report = Onering::Reporter.report().stringify_keys()
+ report = Onering::Reporter.report(options).stringify_keys()
# pull report overrides from the config file
Onering::Config.get('reporter.fields',{}).each do |key, value|
Onering::Logger.debug("Override value #{key} from config file", "Onering::CLI::Report")
\ No newline at end of file