generator-for-devise-jwt: Implement the generator for devise-jwt#96
generator-for-devise-jwt: Implement the generator for devise-jwt#96TheZero0-ctrl wants to merge 1 commit into
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
abhaynikam
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
can you use migration template here instead? I think that would be easier in long run?
There was a problem hiding this comment.
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.
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.
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.
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