Skip to content
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

Generators not appearing in "rails -T" #90

Closed
drnic opened this issue Feb 9, 2021 · 8 comments
Closed

Generators not appearing in "rails -T" #90

drnic opened this issue Feb 9, 2021 · 8 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@drnic
Copy link

drnic commented Feb 9, 2021

rails -T does not include the generators included in this gem. I'm using the gem as installed/configured in JSP.

Within JSP:

$ rails -T | grep not
rails annotate_models                              # Add schema information (as comments) to model and fixture files
rails annotate_routes                              # Adds the route map to routes.rb
rails db:prepare                                   # Runs setup if database does not exist, or runs migrations if it does
rails remove_annotation                            # Remove schema information from model and fixture files
~~~
@excid3
Copy link
Owner

excid3 commented Feb 9, 2021

That's interesting, I had noticed that on Madmin the other day that one of the commands wasn't showing. Wonder why that is?

@excid3 excid3 added bug Something isn't working help wanted Extra attention is needed labels Feb 9, 2021
@drnic
Copy link
Author

drnic commented Feb 9, 2021

AFAIK you just need that desc call before the generator method https://edgeguides.rubyonrails.org/generators.html#creating-your-first-generator but its been a while since I did write a generator

@drnic
Copy link
Author

drnic commented Feb 9, 2021

I'll try to fix it out of retro curiosity

@drnic
Copy link
Author

drnic commented Feb 9, 2021

Closing because I'm an idiot.

  • rails -T returns list of rake tasks
  • rails g returns list of generators
$ rails g
...
Noticed:
  noticed:delivery_method
  noticed:model
  noticed:notification
  • To get help for a generator:
$ rails g noticed:model --help
Usage:
  rails generate noticed:model [Notification] [field:type field:type] [options]
...

@drnic drnic closed this as completed Feb 9, 2021
@excid3
Copy link
Owner

excid3 commented Feb 9, 2021

Ah! That makes sense.

Is it because of the rake file that you see things like rails turbo:install in rails -T

https://github.com/hotwired/turbo-rails/blob/main/lib/tasks/turbo_tasks.rake

@excid3 excid3 reopened this Feb 10, 2021
@excid3
Copy link
Owner

excid3 commented Feb 10, 2021

Gonna reopen this. I think it would be handy to have both and we can have the rake task run the generator.

Should be an easy PR if someone wants to do this. 👍

@rafaelpivato
Copy link

Gonna reopen this. I think it would be handy to have both and we can have the rake task run the generator.

Maybe having one task per generator, or at least repeating the noticed:model generator, would just add trash to the tasks list.

What we could have is a noticed:install task that would call noticed:model and noticed:application_notification (see #94) generators.

@excid3
Copy link
Owner

excid3 commented Feb 22, 2021

I dunno, we're only going to have 3 generators. I don't think 3 will make anything messy.

@excid3 excid3 closed this as completed Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants