mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ac9d32bf90
this lets us leverage Ruby's kwarg handling (exceptions for missing params, etc) ASAP which allows us to skip active support method calls and make sure the exception stack is closer to where the user called the methods.
23 lines
931 B
Ruby
23 lines
931 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.new(CacheDigests.template_name, CacheDigests.finder).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?
|
|
puts JSON.pretty_generate ActionView::Digestor.new(CacheDigests.template_name, CacheDigests.finder).dependencies
|
|
end
|
|
|
|
class CacheDigests
|
|
def self.template_name
|
|
ENV['TEMPLATE'].split('.', 2).first
|
|
end
|
|
|
|
def self.finder
|
|
ApplicationController.new.lookup_context
|
|
end
|
|
end
|
|
end
|