lib/travis/cli/command.rb in travis-1.6.15.1 vs lib/travis/cli/command.rb in travis-1.6.16

- old
+ new

@@ -156,10 +156,13 @@ last_check['etag'] = response.headers['etag'] last_check['version'] = JSON.parse(response.body)['version'] if response.status == 200 end last_check['at'] = Time.now.to_i - error "Outdated CLI version, run `gem install travis` or use --skip-version-check." if Travis::VERSION < last_check['version'] + current = Travis::VERSION.split('.').map { |s| s.to_i } + latest = last_check['version'].split('.').map { |s| s.to_i } + check = current <=> latest + error "Outdated CLI version, run `gem install travis` or use --skip-version-check." if check < 0 rescue Timeout::Error, Faraday::Error::ClientError => error debug "#{error.class}: #{error.message}" end def check_completion