class NCCheckVersion
Public Instance Methods
check_for_updates(semver_path = '', remote_url = '')
click to toggle source
# File lib/ncupdater/nccheck_version.rb, line 3 def check_for_updates(semver_path = '', remote_url = '') @semver_path = semver_path @remote_url = remote_url local_version = Semantic::Version.new "#{current_version}" newer_version = Semantic::Version.new "#{remote_version}" if local_version < newer_version return true end return false end
current_version()
click to toggle source
# File lib/ncupdater/nccheck_version.rb, line 17 def current_version File.open(@semver_path) {|f| f.readline} end
remote_version()
click to toggle source
# File lib/ncupdater/nccheck_version.rb, line 21 def remote_version uri = URI.parse( @remote_url ) http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Get.new(uri.path) response = http.request(request) response.body end