Created
June 14, 2011 16:23
-
-
Save lucaspiller/1025260 to your computer and use it in GitHub Desktop.
Checks whether the version of Git you have installed is the latest.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
doc = Nokogiri::HTML(open('http://git-scm.com/')) | |
latest = if doc.css('#ver').first.content =~ /v([0-9.]+)/ | |
$1 | |
else | |
abort "Borked" | |
end | |
installed = if `git --version` =~ /version ([0-9.]+)/ | |
$1 | |
else | |
abort "Borked" | |
end | |
if installed != latest | |
puts "Yep" | |
else | |
puts "Nope" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment