Sha256: eddaa4c2dca2a68677fdee1b4196e454c480cee5569004bafc4f08d556fafd06

Contents?: true

Size: 444 Bytes

Versions: 4

Compression:

Stored size: 444 Bytes

Contents

require 'net/http'

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

    puts <<-MESSAGE.strip_heredoc

      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

4 entries across 4 versions & 1 rubygems

Version Path
nib-2.1.1 lib/nib/check_for_update.rb
nib-2.1.0 lib/nib/check_for_update.rb
nib-2.0.2 lib/nib/check_for_update.rb
nib-2.0.1 lib/nib/check_for_update.rb