aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorThomas von Deyen <tvdeyen@gmail.com>2013-09-26 21:19:19 +0200
committerThomas von Deyen <tvdeyen@gmail.com>2013-09-26 21:19:19 +0200
commit1825f6fb601b5dffc5694dc83ddd123e76961f19 (patch)
tree621a32860f41e38eba70108ed200e822332774e5 /actionview
parent3f488d4a076ba0146535ef6e2aa9cb21a1882810 (diff)
downloadrails-1825f6fb601b5dffc5694dc83ddd123e76961f19.tar.gz
rails-1825f6fb601b5dffc5694dc83ddd123e76961f19.tar.bz2
rails-1825f6fb601b5dffc5694dc83ddd123e76961f19.zip
Adds template dependencies rake task from cache_digests gem.
This adds the rake tasks `cache_digests:dependencies` and `cache_digests:nested_dependencies` from `cache_digests` gem.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/railtie.rb4
-rw-r--r--actionview/lib/action_view/tasks/dependencies.rake17
2 files changed, 21 insertions, 0 deletions
diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb
index 4113448af0..c2783f6377 100644
--- a/actionview/lib/action_view/railtie.rb
+++ b/actionview/lib/action_view/railtie.rb
@@ -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
diff --git a/actionview/lib/action_view/tasks/dependencies.rake b/actionview/lib/action_view/tasks/dependencies.rake
new file mode 100644
index 0000000000..1b9426c0e5
--- /dev/null
+++ b/actionview/lib/action_view/tasks/dependencies.rake
@@ -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