diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-26 12:24:19 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-26 12:24:19 -0700 |
commit | 7045a5bf37094a05e8cfe9f584e3965de3f63901 (patch) | |
tree | 621a32860f41e38eba70108ed200e822332774e5 /actionview | |
parent | 3f488d4a076ba0146535ef6e2aa9cb21a1882810 (diff) | |
parent | 1825f6fb601b5dffc5694dc83ddd123e76961f19 (diff) | |
download | rails-7045a5bf37094a05e8cfe9f584e3965de3f63901.tar.gz rails-7045a5bf37094a05e8cfe9f584e3965de3f63901.tar.bz2 rails-7045a5bf37094a05e8cfe9f584e3965de3f63901.zip |
Merge pull request #12376 from tvdeyen/cache-digests-rake-tasks
Adds template dependencies rake task from cache_digests gem.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/railtie.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/tasks/dependencies.rake | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index 4113448af0..c2783f6377 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -48,5 +48,9 @@ module ActionView ActionMailer::Base.send(:include, ActionView::Layouts) end end + + rake_tasks do + load "action_view/tasks/dependencies.rake" + end end end diff --git a/actionview/lib/action_view/tasks/dependencies.rake b/actionview/lib/action_view/tasks/dependencies.rake new file mode 100644 index 0000000000..1b9426c0e5 --- /dev/null +++ b/actionview/lib/action_view/tasks/dependencies.rake @@ -0,0 +1,17 @@ +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? + template, format = ENV['TEMPLATE'].split(".") + format ||= :html + puts JSON.pretty_generate ActionView::Digestor.new(template, format, ApplicationController.new.lookup_context).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? + template, format = ENV['TEMPLATE'].split(".") + format ||= :html + puts JSON.pretty_generate ActionView::Digestor.new(template, format, ApplicationController.new.lookup_context).dependencies + end +end |