Rakefile in autosize-rails-1.18.0 vs Rakefile in autosize-rails-1.18.4

- old
+ new

@@ -1,23 +1,46 @@ require "bundler/gem_tasks" + +task :update do + require 'net/http' + require 'json' + + tags_url = 'https://api.github.com/repos/jackmoore/autosize/tags' + tags = JSON.parse(Net::HTTP.get(URI(tags_url))) + latest_tag = tags.first + + if latest_tag['name'] > Autosize::Rails::VERSION + upstream_location = "/jackmoore/autosize/#{latest_tag['commit']['sha']}/jquery.autosize.js" + file_location = File.join(File.dirname(File.absolute_path(__FILE__)), 'vendor', 'assets', 'javascripts', 'jquery.autosize.js') + puts "Downloading new version (#{latest_tag['name']}):" + puts upstream_location + Net::HTTP.start('raw2.github.com', use_ssl: true) do |http| + resp = http.get(upstream_location) + File.open(file_location, 'w') { |file| file.write(resp.body) } + end + puts "Please bump the version.rv, commit and open a pull request with the new version. (#{latest_tag['name']})" + else + puts "Already up to date. (#{latest_tag['name']})" + end +end