diff options
author | Thomas von Deyen <tvdeyen@gmail.com> | 2013-09-26 21:19:19 +0200 |
---|---|---|
committer | Thomas von Deyen <tvdeyen@gmail.com> | 2013-09-26 21:19:19 +0200 |
commit | 1825f6fb601b5dffc5694dc83ddd123e76961f19 (patch) | |
tree | 621a32860f41e38eba70108ed200e822332774e5 /actionview/lib/action_view/tasks | |
parent | 3f488d4a076ba0146535ef6e2aa9cb21a1882810 (diff) | |
download | rails-1825f6fb601b5dffc5694dc83ddd123e76961f19.tar.gz rails-1825f6fb601b5dffc5694dc83ddd123e76961f19.tar.bz2 rails-1825f6fb601b5dffc5694dc83ddd123e76961f19.zip |
Adds template dependencies rake task from cache_digests gem.
This adds the rake tasks `cache_digests:dependencies` and `cache_digests:nested_dependencies` from `cache_digests` gem.
Diffstat (limited to 'actionview/lib/action_view/tasks')
-rw-r--r-- | actionview/lib/action_view/tasks/dependencies.rake | 17 |
1 files changed, 17 insertions, 0 deletions
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 |