From 553b563749517114323b4e8742509227e0daab67 Mon Sep 17 00:00:00 2001 From: Antonio Cangiano Date: Sat, 1 Dec 2012 12:23:39 -0800 Subject: [PATCH] Add db to the list of default annotation folders --- railties/CHANGELOG.md | 2 ++ railties/lib/rails/source_annotation_extractor.rb | 2 +- railties/test/application/rake/notes_test.rb | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 7a68cf0a2e..c3da3094dc 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,5 +1,7 @@ ## Rails 4.0.0 (unreleased) ## +* Add `db` to list of folders included by `rake notes` and `rake notes:custom`. *Antonio Cangiano* + * Engines with a dummy app include the rake tasks of dependencies in the app namespace. Fix #8229 diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index 3474b02af4..ac806e8006 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -15,7 +15,7 @@ class SourceAnnotationExtractor class Annotation < Struct.new(:line, :tag, :text) def self.directories - @@directories ||= %w(app config lib script test) + (ENV['SOURCE_ANNOTATION_DIRECTORIES'] || '').split(',') + @@directories ||= %w(app config db lib script test) + (ENV['SOURCE_ANNOTATION_DIRECTORIES'] || '').split(',') end # Returns a representation of the annotation that looks like this: diff --git a/railties/test/application/rake/notes_test.rb b/railties/test/application/rake/notes_test.rb index 7a227098ba..ac214cdb03 100644 --- a/railties/test/application/rake/notes_test.rb +++ b/railties/test/application/rake/notes_test.rb @@ -60,6 +60,7 @@ module ApplicationTests test 'notes finds notes in default directories' do app_file "app/controllers/some_controller.rb", "# TODO: note in app directory" app_file "config/initializers/some_initializer.rb", "# TODO: note in config directory" + app_file "db/some_seeds.rb", "# TODO: note in db directory" app_file "lib/some_file.rb", "# TODO: note in lib directory" app_file "script/run_something.rb", "# TODO: note in script directory" app_file "test/some_test.rb", 1000.times.map { "" }.join("\n") << "# TODO: note in test directory" @@ -80,6 +81,7 @@ module ApplicationTests assert_match(/note in app directory/, output) assert_match(/note in config directory/, output) + assert_match(/note in db directory/, output) assert_match(/note in lib directory/, output) assert_match(/note in script directory/, output) assert_match(/note in test directory/, output) @@ -96,6 +98,7 @@ module ApplicationTests test 'notes finds notes in custom directories' do app_file "app/controllers/some_controller.rb", "# TODO: note in app directory" app_file "config/initializers/some_initializer.rb", "# TODO: note in config directory" + app_file "db/some_seeds.rb", "# TODO: note in db directory" app_file "lib/some_file.rb", "# TODO: note in lib directory" app_file "script/run_something.rb", "# TODO: note in script directory" app_file "test/some_test.rb", 1000.times.map { "" }.join("\n") << "# TODO: note in test directory" @@ -116,6 +119,7 @@ module ApplicationTests assert_match(/note in app directory/, output) assert_match(/note in config directory/, output) + assert_match(/note in db directory/, output) assert_match(/note in lib directory/, output) assert_match(/note in script directory/, output) assert_match(/note in test directory/, output)