lib/quandl/command/task/updatable.rb in quandl-0.3.7 vs lib/quandl/command/task/updatable.rb in quandl-0.4.0

- old
+ new

@@ -4,19 +4,19 @@ module Updatable extend ActiveSupport::Concern - VERSION_URL="https://raw.github.com/quandl/quandl_command/master/lib/quandl/command/version.rb" + VERSION_URL="https://s3.amazonaws.com/quandl-command/VERSION" included do before_execute :check_for_update_once_daily end def check_for_update_once_daily # short circuit - return if options.production + return if options.sandbox # onwards check_time = config.last_checked_for_update # check time present? if check_time.present? && check_time.is_a?(Time) # has it been more than one day? @@ -36,12 +36,12 @@ # send request response = send_update_request(http, request) # handle output handle_update_response(response) rescue => err - error("An unexpected error occured while checking for updates ... #{err}") - error err.backtrace.join("\n") if trace? + info("An unexpected error occured while checking for updates ... #{err}") + info err.backtrace.join("\n") if trace? ensure config.last_checked_for_update = Time.now end private @@ -62,10 +62,10 @@ def send_update_request(http, request) # send request response = http.request(request) # fetch version number - response.body.split("\n").detect{|r| r =~ /VERSION/ }.split("'").last + response.body.strip.rstrip end def handle_update_response(response) return info(" you are up to date! #{response}") if Quandl::Command::VERSION == response # otherwise they are out of sync \ No newline at end of file