Skip to content

Instantly share code, notes, and snippets.

@TheEskhaton
Last active December 17, 2015 13:48
Show Gist options
  • Save TheEskhaton/5619435 to your computer and use it in GitHub Desktop.
Save TheEskhaton/5619435 to your computer and use it in GitHub Desktop.
A simple Ruby script for downloading a certain jquery version from google CND. i.e. "ruby jget.rb 2.0.0" would download 2.0.0 to jquery.min.js
require('open-uri')
class JGet
def self.GetVersion(ver)
script = '';
open('http://ajax.googleapis.com/ajax/libs/jquery/'+ver +'/jquery.min.js') do |f|
f.each_line{|line| script << line}
end
return script
end
end
begin
ver = ARGV[0]
File.open('jquery.min.js', 'w') do |f|
f.write JGet.GetVersion(ver)
end
puts 'Successfully downloaded version ' + ver
rescue
puts 'Version ' + ver + ' Not Found'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment