From 27e95727d7f1da623cd3f22b643ae5eb0d3a93b1 Mon Sep 17 00:00:00 2001 From: robertomiranda Date: Sun, 16 Mar 2014 14:57:21 -0500 Subject: Add config.annotations, in order to register new extensions for Rake notes at config level --- railties/lib/rails/application/configuration.rb | 4 ++++ railties/test/application/configuration_test.rb | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'railties') diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 20e3de32aa..9aec2f9734 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -1,6 +1,7 @@ require 'active_support/core_ext/kernel/reporting' require 'active_support/file_update_checker' require 'rails/engine/configuration' +require 'rails/source_annotation_extractor' module Rails class Application @@ -149,6 +150,9 @@ module Rails end end + def annotations + SourceAnnotationExtractor::Annotation + end end end end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b39cd3747b..b11fd55170 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -793,5 +793,15 @@ module ApplicationTests assert ActiveRecord::Base.dump_schema_after_migration end + + test "config.annotations wrapping SourceAnnotationExtractor::Annotation class" do + make_basic_app do |app| + app.config.annotations.register_extensions("coffee") do |tag| + /#\s*(#{tag}):?\s*(.*)$/ + end + end + + assert_not_nil SourceAnnotationExtractor::Annotation.extensions[/\.(coffee)$/] + end end end -- cgit v1.2.3