Sha256: f067a49bea85d1c0b4954efebfaa1575643ef7269f71e4b6adce1d562ca05fee

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

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.rb, commit and open a pull request with the new version. (#{latest_tag['name']})"
  else
    puts "Already up to date. (#{latest_tag['name']})"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
autosize-rails-1.18.17 Rakefile
autosize-rails-1.18.15 Rakefile
autosize-rails-1.18.8 Rakefile
autosize-rails-1.18.6 Rakefile