Permalink
Browse files

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

Adds template dependencies rake task from cache_digests gem.
Conflicts:
	actionpack/lib/action_view/railtie.rb
  • Loading branch information...
1 parent b224043 commit 20e0d4d27021c73ff5dc9a75f2afe10c5cf445ce @rafaelfranca rafaelfranca committed Sep 26, 2013
Showing with 21 additions and 0 deletions.
  1. +4 −0 actionpack/lib/action_view/railtie.rb
  2. +17 −0 actionpack/lib/action_view/tasks/dependencies.rake
@@ -35,5 +35,9 @@ class Railtie < Rails::Railtie # :nodoc:
end
end
end
+
+ rake_tasks do
+ load "action_view/tasks/dependencies.rake"
+ end
end
end
@@ -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

0 comments on commit 20e0d4d

Please sign in to comment.