Sha256: 48f21083a47790ba79c413c6a35b2c9a02c441ad099cb834baf0115454f9ce86

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

require 'bundler'
Bundler::GemHelper.install_tasks

# Check if versions are correct between VERSION constants and .js files
#
task :release => [:guard_version]

task :guard_version do
  def check_version(file, pattern, constant)
    body = File.read("vendor/assets/javascripts/#{file}")
    match = body.match(pattern) or abort "Version check failed: no pattern matched in #{file}"
    file_version = body.match(pattern)[1]
    constant_version = Jquery::Rails.const_get(constant)

    unless constant_version == file_version
      abort "Jquery::Rails::#{constant} was #{constant_version} but it should be #{file_version}"
    end
  end

  check_version('jquery.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_VERSION')
  check_version('jquery2.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_2_VERSION')
end

task :update_jquery do
  def download_jquery(filename, version)
    suffix = "-#{version}"

    puts "Downloading #{filename}.js"
    puts `curl -o vendor/assets/javascripts/#{filename}.js http://code.jquery.com/jquery#{suffix}.js`
    puts "Downloading #{filename}.min.js"
    puts `curl -o vendor/assets/javascripts/#{filename}.min.js http://code.jquery.com/jquery#{suffix}.min.js`
    puts "Downloading #{filename}.min.map"
    puts `curl -o vendor/assets/javascripts/#{filename}.min.map http://code.jquery.com/jquery#{suffix}.min.map`
  end

  download_jquery('jquery', Jquery::Rails::JQUERY_VERSION)
  download_jquery('jquery2', Jquery::Rails::JQUERY_2_VERSION)
  puts "\e[32mDone!\e[0m"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jquery-rails-4.0.0.beta2 Rakefile
jquery-rails-4.0.0.beta1 Rakefile