1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionview/lib/action_view/tasks/cache_digests.rake
Dharam Gollapudi 056d0fd53c 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.
2016-03-09 15:32:11 -08:00

23 lines
948 B
Ruby

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