Rake notes directories #5175

Merged
merged 5 commits into from Apr 30, 2012

Projects

None yet

4 participants

@jasonnoble
Contributor

These commits do two things:

Verify that Annotations are found in all the default directories
      app config lib script test

If an environment variable SOURCE_ANNOTATION_DIRECTORIES exists, it searches there too
      SOURCE_ANNOTATION_DIRECTORIES='dir1,dir2' bundle exec rake notes
          searches:  app config lib script test dir1 dir2

References: #4536, #4540

@rafaelfranca
Member

Hey @jasonnoble could you rebase it against master. I'll ask to someone merge it.

Also I think that we have to document this variable in the guides

@jasonnoble
Contributor

Rebased, added quick documentation to the command_line.textile. I would do this on lifo, but it should probably go through as part of this pull request. //cc @rafaelfranca

@rafaelfranca
Member
@jeremy
Member
jeremy commented Apr 30, 2012

Looks good! Made a couple style notes re. method newlines.

@jeremy jeremy commented on an outdated diff Apr 30, 2012
railties/lib/rails/source_annotation_extractor.rb
@@ -48,7 +51,7 @@ def initialize(tag)
# 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)
@jeremy
jeremy Apr 30, 2012 Member

Style: please add spacing on default arg. dirs = ...

@jeremy jeremy commented on an outdated diff Apr 30, 2012
railties/test/application/rake/notes_test.rb
@@ -12,7 +12,8 @@ def teardown
teardown_app
end
- test 'notes' do
+ test 'notes finds notes for certain file_types' do
+
@jeremy
jeremy Apr 30, 2012 Member

Style: no newline padding within the test block

@jeremy jeremy commented on an outdated diff Apr 30, 2012
railties/test/application/rake/notes_test.rb
@@ -51,6 +52,82 @@ def teardown
end
end
+ test 'notes finds notes in default directories' do
@jeremy
jeremy Apr 30, 2012 Member

Style: add newline before this test & remove its padding

jasonnoble added some commits Feb 25, 2012
@jasonnoble @jasonnoble jasonnoble Add test coverage for rake notes
Add separate tests to verify directories covered
Add tests to verify file_types
b5472cf
@jasonnoble @jasonnoble jasonnoble 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
e053b41
@jasonnoble jasonnoble Add documentation to command_line.textile explaining how to use addit…
…ional notes directories
37e4e9b
@jasonnoble jasonnoble Fixed styling issues brought up by @jeremy 7731231
@jasonnoble
Contributor

Updated style to follow @jeremy's comments.

@jeremy jeremy commented on an outdated diff Apr 30, 2012
railties/test/application/rake/notes_test.rb
+ assert_match /note in lib directory/, output
+ assert_match /note in script directory/, output
+ assert_match /note in test directory/, output
+ assert_no_match /note in some_other directory/, output
+
+ assert_equal 5, lines.size
+
+ lines.each do |line_number|
+ assert_equal 4, line_number.size
+ end
+ end
+
+ end
+
+ test 'notes finds notes in custom directories' do
+
@jeremy
jeremy Apr 30, 2012 Member

Still newline padding here :)

@jasonnoble
Contributor

Fixed line 93, also removed the blank lines (like line 89).

@jeremy jeremy merged commit c435feb into rails:master Apr 30, 2012
@kelso
kelso commented on e053b41 Jul 17, 2013

This commit is awesome!

Finally, I can use rake notes and search for TODOs and FIXes in rspec folder "spec"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment