-
Notifications
You must be signed in to change notification settings - Fork 622
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
Refactor lib/annotate.rb #707
Conversation
@@ -11,46 +11,46 @@ task annotate_models: :environment do | |||
require "#{annotate_lib}/annotate/active_record_patch" | |||
|
|||
options = {is_rake: true} | |||
ENV['position'] = options[:position] = Annotate.fallback(ENV['position'], 'before') | |||
ENV['position'] = options[:position] = Annotate::Helpers.fallback(ENV['position'], 'before') | |||
options[:additional_file_patterns] = ENV['additional_file_patterns'] ? ENV['additional_file_patterns'].split(',') : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be mixed in instead of specifying full path? It would also cut back the number of changes needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ctran this is done intentionally for now to make it easier to see where everything is coming from. Do you think it would be okay to keep for now?
I'm thinking we could untangle lib/annotate.rb
. I'm looking at the Pry gem as a source of inspiration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine either way, was just wondering if you had specific reasons to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make it more explicit where it's coming from right now. I'm expecting Helpers
to be a temporary solution until it's clearer what the different pieces are.
This change converts .all_options into a constant and moves it into Annotate::Constants. It also changes usages of .all_options.
This change converts .all_options into a constant and moves it into Annotate::Constants. It also changes usages of .all_options.
lib/annotate.rb
is bloated. This PR refactors methods out of it intoAnnotate::Helpers
and adds test coverage for the methods.