diff options
author | Jason Noble & Ralph Shnelvar <perlwizard@gmail.com> | 2012-02-25 14:01:40 -0700 |
---|---|---|
committer | Jason Noble <github+jasonn@jasonnoble.org> | 2012-04-30 07:48:36 -0600 |
commit | e053b415e7874b56c5ac788644c68e264a1cef33 (patch) | |
tree | d127dee22b0a6defe3af49ccbb002f654cddd38c /railties/lib/rails | |
parent | b5472cf7f22cb6d06bfdb329b13b919998e4ad7b (diff) | |
download | rails-e053b415e7874b56c5ac788644c68e264a1cef33.tar.gz rails-e053b415e7874b56c5ac788644c68e264a1cef33.tar.bz2 rails-e053b415e7874b56c5ac788644c68e264a1cef33.zip |
Add ability to specify custom annotation directories
SOURCE_ANNOTATION_DIRECTORIES='dir1,dir2' bundle exec rake notes
Searches app, config, lib, script, test (default)
Also searches dir1, dir2
References: #4536, #4540
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/source_annotation_extractor.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index a443c73962..0f736339ff 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -14,6 +14,9 @@ # of the line (or closing ERB comment tag) is considered to be their text. class SourceAnnotationExtractor class Annotation < Struct.new(:line, :tag, :text) + def self.directories + @@directories ||= %w(app config lib script test) + (ENV['SOURCE_ANNOTATION_DIRECTORIES'] || '').split(',') + end # Returns a representation of the annotation that looks like this: # @@ -48,7 +51,7 @@ class SourceAnnotationExtractor # Returns a hash that maps filenames under +dirs+ (recursively) to arrays # with their annotations. - def find(dirs=%w(app config lib script test)) + def find(dirs=Annotation.directories) dirs.inject({}) { |h, dir| h.update(find_in(dir)) } end |