1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #12376 from tvdeyen/cache-digests-rake-tasks

Adds template dependencies rake task from cache_digests gem.
This commit is contained in:
Rafael Mendonça França 2013-09-26 12:24:19 -07:00
commit 7045a5bf37
2 changed files with 21 additions and 0 deletions

View file

@ -48,5 +48,9 @@ module ActionView
ActionMailer::Base.send(:include, ActionView::Layouts)
end
end
rake_tasks do
load "action_view/tasks/dependencies.rake"
end
end
end

View file

@ -0,0 +1,17 @@
namespace :cache_digests do
desc 'Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)'
task :nested_dependencies => :environment do
abort 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present?
template, format = ENV['TEMPLATE'].split(".")
format ||= :html
puts JSON.pretty_generate ActionView::Digestor.new(template, format, ApplicationController.new.lookup_context).nested_dependencies
end
desc 'Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)'
task :dependencies => :environment do
abort 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present?
template, format = ENV['TEMPLATE'].split(".")
format ||= :html
puts JSON.pretty_generate ActionView::Digestor.new(template, format, ApplicationController.new.lookup_context).dependencies
end
end