Sha256: 6edf4324946c047e8e1210763b9cc899059067bfed6eeeb856c091706fadaa84

Contents?: true

Size: 426 Bytes

Versions: 7

Compression:

Stored size: 426 Bytes

Contents

require 'net/http'

class Nib::CheckForUpdate
  def self.execute(_, _)
    return if installed == latest

    puts <<-MESSAGE

    An update is available for nib: #{latest}
    Use 'nib update' to install the latest version
    MESSAGE
  end

  def self.installed
    Nib::VERSION
  end

  def self.latest
    url = 'https://raw.githubusercontent.com/technekes/nib/master/VERSION'

    Net::HTTP.get(URI.parse(url))
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nib-2.0.0 lib/nib/check_for_update.rb
nib-1.7.0 lib/nib/check_for_update.rb
nib-1.6.0 lib/nib/check_for_update.rb
nib-1.5.1 lib/nib/check_for_update.rb
nib-1.5.0 lib/nib/check_for_update.rb
nib-1.4.2 lib/nib/check_for_update.rb
nib-1.4.1 lib/nib/check_for_update.rb