Sha256: 4eb11a4b33039a0aa39f44f13a183dccc4a96ae3e4f4f4130c6d04d1bace8d3d

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'fileutils'
require 'json'
require "bundler/gem_tasks"

namespace :paint do
  desc "Update Paint to module version"
  task :update do |task|
    if module_matches_bower_version
      assets_dir = "./vendor/assets"
      rm_r(assets_dir, force: true)

      mkdir_p("#{assets_dir}/stylesheets")
      mkdir_p("#{assets_dir}/images")

      cp("./vendor/paint/bower.json", "#{assets_dir}/stylesheets")
      Dir.chdir("#{assets_dir}/stylesheets") { sh("bower install") && rm("bower.json") }

      images = Rake::FileList["./vendor/paint/images/**"]
      stylesheets = Rake::FileList["./vendor/paint/**"].exclude(/\/images/, /\.json/, /\.md/)

      cp_r(stylesheets, "#{assets_dir}/stylesheets")
      cp_r(images, "#{assets_dir}/images")
    else
      puts "Update module version (./lib/paint-rails/version.rb) to match bower.json version"
    end
  end

  def module_matches_bower_version
    bower_json = JSON.parse(File.read("./vendor/paint/bower.json"))
    bower_json.fetch("version") == Paint::Rails::VERSION
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
paint-rails-0.7.24 Rakefile
paint-rails-0.6.7 Rakefile
paint-rails-0.5.2 Rakefile