aboutsummaryrefslogblamecommitdiffstats
path: root/actionview/lib/action_view/tasks/dependencies.rake
blob: b39f7d583becc70d71da383377267a21761feed0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                                                                               
                                                                                                               




                                                                                                    








                                                                                                        

     
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(name: template_name, finder: 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(name: template_name, finder: finder).dependencies
  end

  def template_name
    ENV['TEMPLATE'].split('.', 2).first
  end

  def finder
    ApplicationController.new.lookup_context
  end
end