-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
generator-for-devise-jwt: Implement the generator for devise-jwt #96
base: main
Are you sure you want to change the base?
generator-for-devise-jwt: Implement the generator for devise-jwt #96
Conversation
@abhaynikam Could you please review this PR at your convenience and let me know if any changes are necessary? Thank you for your time. |
Update: I will review this tonight. |
@TheZero0-ctrl Let's fix merge conflicts here |
776e246
to
5fd962b
Compare
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.
Left some comments. Excited to get this merged 🥇
|
||
def verify_presence_of_devise_gem | ||
gem_file_content_array = File.readlines("Gemfile") | ||
devise_is_installed = gem_file_content_array.any? { |line| line.include?('devise') } |
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 think I recently added a helper method called gem_installed?
. can you try using that here?
abort | ||
end | ||
|
||
def verify_presence_of_devise_model |
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 my preference, I usually use ensure_
for such checks. fine to keep this if you prefer this way :)
|
||
def add_devise_jwt_gem | ||
say "Adding devise-jwt gem", :green | ||
gem "devise-jwt" |
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.
will this run bundle installer?
|
||
def configure_jti_matcher_strategy | ||
model_name = options[:model_name].underscore | ||
Bundler.with_unbundled_env do |
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 you use migration template here instead? I think that would be easier in long run?
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 find it challenging to determine the next migration number for the migration file name. Do you have any suggestions for a better approach? I am considering using the current timestamp.
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 find this function on rails source code
def self.next_migration_number(dirname)
next_migration_number = current_migration_number(dirname) + 1
ActiveRecord::Migration.next_migration_number(next_migration_number)
end
can I use this and use migration_template method by including Rails::Generators::Migration ?
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.
here is the documentation of migration_template
Creates a migration template at the given destination. The difference to the default template method is that the migration version is appended to the destination file name.
The migration version, migration file name, migration class name are available as instance variables in the template to be rendered.
|
||
end | ||
|
||
def configure_denylist_strategy |
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.
Ditto. I think easier to just add templates for all migrations you want for denylist.
5fd962b
to
e474e3f
Compare
e474e3f
to
fc6f26c
Compare
fc6f26c
to
54b8d5e
Compare
Task done