Sha256: 0b167de72f8322781ba70daef06b48c6cf8eba401cb910cb8e74872ad21c67e5
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
unless defined?(APP_FILE) && defined?(APP_CLASS) $stderr.write "Error: Please set APP_FILE and APP_CLASS before setting up AssetPack rake tasks.\n" $stderr.write "Example:\n" $stderr.write " APP_FILE = 'init.rb'\n" $stderr.write " APP_CLASS = 'Application'\n" $stderr.write " require 'sinatra/assetpack/rake'\n" $stderr.write "\n" exit end def class_from_string(str) str.split('::').inject(Object) do |mod, class_name| mod.const_get(class_name) end end def app require File.expand_path(APP_FILE, Dir.pwd) class_from_string(APP_CLASS) end namespace :assetpack do desc "Precompile all assets" task :precompile => ['precompile:packages', 'precompile:files'] namespace :precompile do desc "Precompile packages only" task :packages do puts "Precompiling packages ..." app.assets.build_packages! do |file| puts "+ #{file.gsub(Dir.pwd, '')}" end end desc "Precompile files only" task :files do puts "Precompiling files ..." app.assets.build_files! do |file| puts "+ #{file.gsub(Dir.pwd, '')}" end end end # For backwards compatibility task :build do puts "WARNING: assetpack:build is deprecated. Use assetpack:precompile" Rake::Task["assetpack:precompile"].invoke end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-assetpack-0.3.5 | lib/sinatra/assetpack/rake.rb |