rubyrakehanamihanami-modelrom-rb

Using Hanami model and rake tasks without a router etc


I'm going to write a service that will using amqp protocol, without http at all. I like hanami's paradigm of repository-entity-model-interactors and I wonder to use those in my project. Generating all that stuff by hand, sure, is boring.

So, I wonder to grab rake tasks. Looking into config/environment etc, ughhhh. What is the best method, shortly, to use those tools without hanami router and controllers? Or, it is all integrated tightly?

As I think for that moment, there are two ways:

a) To include only hanami-model into my Gemfile, then copy by hand every needed file from gem hanami.

b) To create hanami project and do not use rackup.

I'm disappointed.


Solution

  • Alternatively, you can add hanami as a development gem. That gives you access to the code generators. At the deploy stage, you don't bundle hanami, so the app will only have hanami-model and hanami-utils in production.