Updated rails_runner.rb to work with sprockets-2.0rc15.
This commit is contained in:
parent
acd54ab19c
commit
ba18f948a6
@ -14,18 +14,35 @@ module Guard
|
|||||||
extend Rake::DSL
|
extend Rake::DSL
|
||||||
|
|
||||||
def clean
|
def clean
|
||||||
assets = Rails.application.config.assets
|
assets = ::Rails.application.config.assets
|
||||||
public_asset_path = Rails.public_path + assets.prefix
|
public_asset_path = File.join(::Rails.public_path, config.assets.prefix)
|
||||||
rm_rf public_asset_path, :secure => true
|
rm_rf public_asset_path, :secure => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def precompile
|
def precompile
|
||||||
Sprockets::Helpers::RailsHelper
|
Sprockets::Helpers::RailsHelper
|
||||||
|
::ActionView::Base
|
||||||
assets = Rails.application.config.assets.precompile
|
|
||||||
# Always perform caching so that asset_path appends the timestamps to file references.
|
config = ::Rails.application.config
|
||||||
Rails.application.config.action_controller.perform_caching = true
|
env = ::Rails.application.assets
|
||||||
Rails.application.assets.precompile(*assets)
|
target = ::Rails.root.join("public#{config.assets.prefix}")
|
||||||
|
|
||||||
|
config.assets.precompile.each do |path|
|
||||||
|
env.each_logical_path do |logical_path|
|
||||||
|
if path.is_a?(::Regexp)
|
||||||
|
next unless path.match(logical_path)
|
||||||
|
else
|
||||||
|
next unless ::File.fnmatch(path.to_s, logical_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
if asset = env.find_asset(logical_path)
|
||||||
|
filename = target.join(asset.digest_path)
|
||||||
|
mkdir_p filename.dirname
|
||||||
|
asset.write_to(filename)
|
||||||
|
asset.write_to("#{filename}.gz") if filename.to_s =~ /\.(css|js)$/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user