Skip to content

Add root_dir capability for multiple roots #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2015
Merged

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
@@ -76,6 +76,10 @@ def self.setup_options(options = {})
options[:model_dir] = ['app/models']
end

if(options[:root_dir].empty?)
options[:root_dir] = ['/']
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