diff options
author | Dharam Gollapudi <dharam.gollapudi@gmail.com> | 2016-03-09 15:32:11 -0800 |
---|---|---|
committer | Dharam Gollapudi <dharam.gollapudi@gmail.com> | 2016-03-09 15:32:11 -0800 |
commit | 056d0fd53c583cbd6566f994decee869ce8315e3 (patch) | |
tree | f5ec5c8e9b57cd56f2b538c2847cc0675353ade0 /actionview/lib/action_view/tasks/cache_digests.rake | |
parent | 2506c7979306f25a4971f6e4c5c1d79b0c2843a5 (diff) | |
download | rails-056d0fd53c583cbd6566f994decee869ce8315e3.tar.gz rails-056d0fd53c583cbd6566f994decee869ce8315e3.tar.bz2 rails-056d0fd53c583cbd6566f994decee869ce8315e3.zip |
Rename dependencies.rake to cache_digests.rake
As the tasks are related to cache_digests and
as they are already namespaced under cache_digests,
renaming to cache_digests.rake makes it to know
where to find these tasks.
Diffstat (limited to 'actionview/lib/action_view/tasks/cache_digests.rake')
-rw-r--r-- | actionview/lib/action_view/tasks/cache_digests.rake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionview/lib/action_view/tasks/cache_digests.rake b/actionview/lib/action_view/tasks/cache_digests.rake new file mode 100644 index 0000000000..045bdf5691 --- /dev/null +++ b/actionview/lib/action_view/tasks/cache_digests.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 |