Closed swerner closed 1 month ago
Does everyone use Thor/ERB templates? For generators. Yes, that has been my experience. It works great.
If you have your eye making the cli.rb
a standalone sublayer
executable eventually thor
will also get you 80% of the way there also.
Thanks! Dug into this more and I think you're right, thor
probably solves all my problems with the current implementation and makes it easier to add the next bit of functionality we're working on for code generation
Surprised how much cleaner the template generation is. I think there are a few more places I can simplify further but this is a great start. Thanks for the suggestion @mdeering !
The code in
cli.rb
is already starting to get messy and complicated. I have to imagine there's is an established pattern for something like this.I'm sure Rails has a really nice way of doing it, and I imagine at least Sinatra does as well. What other ruby projects let you generate new projects? Does everyone use Thor/ERB templates? Something else?
Keeping this ticket here as a placeholder to hold all the research and try to answer these questions before refactoring cli.rb and adding too many more templates or commands...