Last active
December 17, 2015 13:48
-
-
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
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') | |
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