noticed icon indicating copy to clipboard operation
noticed copied to clipboard

Generators not appearing in "rails -T"

Open drnic opened this issue 3 years ago • 8 comments

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
~~~

drnic avatar Feb 09 '21 22:02 drnic

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 avatar Feb 09 '21 22:02 excid3

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 avatar Feb 09 '21 22:02 drnic

I'll try to fix it out of retro curiosity

drnic avatar Feb 09 '21 22:02 drnic

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 avatar Feb 09 '21 22:02 drnic

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 avatar Feb 09 '21 22:02 excid3

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. 👍

excid3 avatar Feb 10 '21 15:02 excid3

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.

rafaelpivato avatar Feb 21 '21 19:02 rafaelpivato

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

excid3 avatar Feb 22 '21 17:02 excid3