Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 29 lines (17 sloc) 691 Bytes
#!/usr/bin/env ruby
require 'bundler/setup'
require 'restclient'
require 'json'
print "latest jenkins version..."
jenkins_metadata = JSON.parse RestClient.get("http://updates.jenkins-ci.org/update-center.json").split("\n")[1..-2].join("\n")
puts current_jenkins_version = jenkins_metadata['core']['version']
print "latest gem version..."
gem_metadata = JSON.parse RestClient.get("http://rubygems.org/api/v1/gems/jenkins-war.json")
puts current_gem_version = gem_metadata['version']
if current_jenkins_version > current_gem_version
puts "upgrading..."
$stdout.flush
exec "rake push[#{current_jenkins_version}]"
else
puts "no need to upgrade. current gem is the latest"
end