Rails::Command::NotesCommand and makes
rake notes use it under the hood
This PR adds a new
Environment variables used in the
Ability to register additional default directories and extensions by using
Backward compatibility / Future deprecation
The commands are fully backward compatible with
Calling any notes command with
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (or someone else) soon.
If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.
This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.
Please see the contribution instructions for more information.
sikachu left a comment
I have a few comments, which many of them are just wording improvements. I like the direction of your patch, so I hope my comments won't discourage you from pushing this patch to merge. Thank you very much.
Consequently, I suspect we'll need to teach the new command how to read rake-style options (while showing a deprecation message)... and then the rake task can be a straight pass-through invocation.
The only place these changes are breaking the current
Should I add support for
Ah, okay, cool.
A quick GitHub-wide code search says "maybe yes" to me. (Looking at those, widespread use of forms like
I'll make some changes to make sure
The thing we need to be aware here is that we lose the ability to dynamically add more directories entirely from the command line which could be considered a regression.
When searching for
If their use case is not covered by that deprecation warning, we can add an option to
Anyway, I understand it's not a majority case so I'll get rid of
I'm not sure I understand what the purpose of --skip-defaults would be in this case. Without default it would search in no directories for no annotations which would be pretty pointless. But maybe I'm misunderstanding something :)
I got rid of the
I also updated the description of this PR to reflect the change in approach. It should be good to go now and fully backward compatible.
@nicolas-brousse My guess it that it's too usage specific to be added to the Rails framework.
I think a more generic approach would be to add support for enhancing / hooking into a specific
* Get rid of references to rake notes in the documentation * Get rid of references to environement variables used in SourceAnnotationExtractor * Updates the command line guide to reflect the new rails notes API
* It is called with `rails notes` * It defaults to displaying [OPTIMIZE, FIXME and TODO] annotations * It accepts custom annotations by using `rails notes -a CUSTOM_ANNOTATION OTHER_ANNOTATION` * It defaults to look for annotations in [app config db lib test] as dictated by SourceAnnotationExtractor * It supports ENV["SOURCE_ANNOTATION_DIRECTORIES"] but adds a deprecation warning and recommends using register_directories instead
* Require the application and environnement in the notes command in order to load the config files * Adds tests for both register_directories and register_extensions added to a config file
* Invokes the notes Rails::Command and passes the rake task ENV variables as annotations options to it * Adds a deprecation warning for unsupported commands * Gets rid of reference to ENV["SOURCE_ANNOTATION_DIRECTORIES"] in SourceAnnotationExtractor since its now dealt with in the NotesCommand * Gets rid of rake desc for each rake notes task so they are not documented while using `rails -T` or `rails --help`
* SOURCE_ANNOTATION_DIRECTORIES deprecation * Deprecation of `rake notes`, use `rails notes` instead * Deprecation of `rails notes:custom ANNOTATION=custom`, `rails notes:optimize`, `rails notes:todo`, and `rails notes:fixme` in favor of passing `-annotations` or `-a` to `rails notes` * They have all been deprecrated in rails#33220