Skip to content

Conversation

djsegal
Copy link
Contributor

@djsegal djsegal commented Nov 22, 2015


Annotations for models in subdirectories of engines/subtrees/etc #291


I believe this is similar to the following issues: #190, #131, #88

To get it to work on my project, I have the following 2 lines in auto_annotate_models.rake:

 'model_dir'            => ["app/models", "lib/subtree/app/models"],
 'root_dir'             => ["/", "lib/subtree"],

@djsegal djsegal changed the title Add root_dir capability for multiple roots: #291 Add root_dir capability for multiple roots Nov 22, 2015
lib/annotate.rb Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be Rails.root? A slash doesn't seem to a correct default value from the caller/user perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thats true, we could just make the default ''
  • The place where root_dir is used in will be unchanged:
File.join(root_directory, UNIT_TEST_DIR,  "%MODEL_NAME%_test.rb")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the change so I can accept the PR?

@djsegal
Copy link
Contributor Author

djsegal commented Nov 30, 2015

@ctran I just finished the update. (i'll clean up the other PRs after the merge)


One note, I did some minor refactoring:

  • I added MATCHED_TYPES = %w(test fixture factory serializer scaffold) to top of lib/annotate/annotate_models.rb
  • i default get_patterns to use MATCHED_TYPES, i.e. get_patterns(pattern_types=MATCHED_TYPES)

@ctran
Copy link
Owner

ctran commented Dec 1, 2015

Awesome. Thanks.

ctran added a commit that referenced this pull request Dec 1, 2015
Add root_dir capability for multiple roots
@ctran ctran merged commit 0fbfdc3 into ctran:develop Dec 1, 2015
@ctran ctran added this to the v2.7.0 milestone Dec 1, 2015
@ctran ctran added the bug label Dec 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants