lib/cc/cli/version_checker.rb in codeclimate-0.60.1 vs lib/cc/cli/version_checker.rb in codeclimate-0.61.0

- old
+ new

@@ -8,11 +8,11 @@ VERSION_CHECK_TIMEOUT = 60 * 60 # 1 Hour in seconds DEFAULT_VERSIONS_URL = "https://versions.codeclimate.com".freeze def check - return unless global_config.check_version? + return unless global_config.check_version? && version_check_is_due? print_new_version_message if outdated? global_config.save rescue => error @@ -24,23 +24,15 @@ def version_check_is_due? Time.now > global_cache.last_version_check + VERSION_CHECK_TIMEOUT end def outdated? - if version_check_is_due? - api_response["outdated"] == true - else - global_cache.outdated? - end + api_response["outdated"] end def latest_version - if version_check_is_due? - api_response["latest"] - else - global_cache.latest_version - end + api_response["latest"] end def print_new_version_message warn "A new version (v#{latest_version}) is available" end @@ -49,14 +41,11 @@ @api_response ||= begin cache! JSON.parse(api_response_body) rescue JSON::ParserError => error CLI.debug(error) - # We don't know so use cached values or pretend all is peachy. We'll - # try again next time. { - "latest" => global_cache.latest_version || version, - "outdated" => global_cache.outdated || false, + "outdated" => false, } end end def api_response_body