Sha256: 90e02bf1b8cb45c2eb1bd17fe3fcbb794cadd238afa3e7e69c89eab0650b2694
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
# encoding: utf-8 require "find" require "open-uri" require "fileutils" require "pathname" namespace :pages do namespace :assets do namespace :update do desc "Updates jQuery" task jquery: :environment do puts "* Updating jQuery..." output = open("http://code.jquery.com/jquery.min.js").read File.open("app/assets/javascripts/jquery.js", "w") do |fh| fh.write output end end desc "Updates legacy assets" task :legacy do if File.exist?("public/plugin_assets") puts "* Removing old plugin assets" FileUtils.rm_rf "public/plugin_assets" end if File.exist?("public/javascripts") puts "* Removing old javascripts" FileUtils.rm_rf "public/javascripts" end if File.exist?("public/stylesheets") puts "* Removing old stylesheets" FileUtils.rm_rf "public/stylesheets" end Find.find("app/assets") do |path| next unless path =~ /\.coffee$/ && !(path =~ /\.js\.coffee$/) new_path = path.gsub(/\.coffee$/, ".js.coffee") puts "#{path} => #{new_path}" FileUtils.mv(path, new_path) end Find.find("app/assets") do |path| next unless path =~ /\.scss$/ && !(path =~ /\.css\.scss$/) new_path = path.gsub(/\.scss$/, ".css.scss") puts "#{path} => #{new_path}" FileUtils.mv(path, new_path) end end end desc "Update all assets" task update: ["update:jquery"] do end desc "Update to SCSS" task convert_to_scss: :environment do assets_dir = Rails.root.join("app", "assets", "stylesheets") Find.find(assets_dir) do |path| next unless path =~ /\.css$/ scss_path = path.gsub(/\.css$/, ".css.scss") `git mv #{path} #{scss_path}` end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.4.3 | lib/tasks/pages/assets.rake |
pages_core-3.5.1 | lib/tasks/pages/assets.rake |
pages_core-3.4.2 | lib/tasks/pages/assets.rake |