aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/tasks/dependencies.rake
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-03-10 07:41:31 +1030
committerMatthew Draper <matthew@trebex.net>2016-03-10 07:41:31 +1030
commitbf79b81740538e96c4881a7c27775a8faf966555 (patch)
treeb1b26e547133360d767cf35d9fc1e43236b25c7b /actionview/lib/action_view/tasks/dependencies.rake
parentb3c487515c11c367855eda7742bda4a3d680b740 (diff)
downloadrails-bf79b81740538e96c4881a7c27775a8faf966555.tar.gz
rails-bf79b81740538e96c4881a7c27775a8faf966555.tar.bz2
rails-bf79b81740538e96c4881a7c27775a8faf966555.zip
Revert "Merge pull request #24125 from dharamgollapudi/patch-3"
This reverts commit b3c487515c11c367855eda7742bda4a3d680b740, reversing changes made to 4b43651884309c0f5be4dbdd11ea4d16fb880c30.
Diffstat (limited to 'actionview/lib/action_view/tasks/dependencies.rake')
-rw-r--r--actionview/lib/action_view/tasks/dependencies.rake23
1 files changed, 23 insertions, 0 deletions
diff --git a/actionview/lib/action_view/tasks/dependencies.rake b/actionview/lib/action_view/tasks/dependencies.rake
new file mode 100644
index 0000000000..045bdf5691
--- /dev/null
+++ b/actionview/lib/action_view/tasks/dependencies.rake
@@ -0,0 +1,23 @@
+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?
+ puts JSON.pretty_generate ActionView::Digestor.tree(CacheDigests.template_name, CacheDigests.finder).children.map(&:to_dep_map)
+ 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?
+ puts JSON.pretty_generate ActionView::Digestor.tree(CacheDigests.template_name, CacheDigests.finder).children.map(&:name)
+ end
+
+ class CacheDigests
+ def self.template_name
+ ENV['TEMPLATE'].split('.', 2).first
+ end
+
+ def self.finder
+ ApplicationController.new.lookup_context
+ end
+ end
+end