2013-09-26 15:19:19 -04:00
|
|
|
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?
|
2016-02-12 17:30:13 -05:00
|
|
|
puts JSON.pretty_generate ActionView::Digestor.new(CacheDigests.template_name, CacheDigests.finder).nested_dependencies
|
2013-09-26 15:19:19 -04:00
|
|
|
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?
|
2016-02-12 17:30:13 -05:00
|
|
|
puts JSON.pretty_generate ActionView::Digestor.new(CacheDigests.template_name, CacheDigests.finder).dependencies
|
2014-06-10 07:34:14 -04:00
|
|
|
end
|
|
|
|
|
2014-09-26 14:55:40 -04:00
|
|
|
class CacheDigests
|
|
|
|
def self.template_name
|
|
|
|
ENV['TEMPLATE'].split('.', 2).first
|
|
|
|
end
|
2014-06-10 07:34:14 -04:00
|
|
|
|
2014-09-26 14:55:40 -04:00
|
|
|
def self.finder
|
|
|
|
ApplicationController.new.lookup_context
|
|
|
|
end
|
2013-09-26 15:19:19 -04:00
|
|
|
end
|
|
|
|
end
|