lib/ssh_scan/update.rb in ssh_scan-0.0.15 vs lib/ssh_scan/update.rb in ssh_scan-0.0.16

- old
+ new

@@ -3,10 +3,14 @@ require 'ssh_scan/version' require 'net/http' module SSHScan class Update + def initialize + @errors = [] + end + def next_patch_version(version = SSHScan::VERSION) major, minor, patch = version.split(".") patch_num = patch.to_i patch_num += 1 @@ -32,18 +36,23 @@ def gem_exists?(version = SSHScan::VERSION) uri = URI("https://rubygems.org/gems/ssh_scan/versions/#{version}") begin res = Net::HTTP.get_response(uri) - rescue + rescue Exception => e + @errors << e.message return false end if res.code != "200" return false else return true end + end + + def errors + @errors.uniq end def newer_gem_available?(version = SSHScan::VERSION) if gem_exists?(next_patch_version(version)) return true