sublayerapp / sublayer

A model-agnostic Ruby Generative AI DSL and framework. Provides base classes for building Generators, Actions, Tasks, and Agents that can be used to build AI powered applications in Ruby.
https://docs.sublayer.com
MIT License
109 stars 2 forks source link

Look into how other ruby projects handle generating templates #77

Closed swerner closed 1 month ago

swerner commented 2 months ago

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

mdeering commented 2 months 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.

swerner commented 1 month ago

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

swerner commented 1 month ago

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 !