Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
Created June 14, 2011 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaspiller/1025260 to your computer and use it in GitHub Desktop.
Save lucaspiller/1025260 to your computer and use it in GitHub Desktop.
Checks whether the version of Git you have installed is the latest.
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