Class: Nib::CheckForUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/nib/check_for_update.rb

Class Method Summary collapse

Class Method Details

.execute(_, _) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/nib/check_for_update.rb', line 4

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

.installedObject



14
15
16
# File 'lib/nib/check_for_update.rb', line 14

def self.installed
  Nib::VERSION
end

.latestObject



18
19
20
21
22
# File 'lib/nib/check_for_update.rb', line 18

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

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