After working for a while on my first non-web based ruby project, I’ve tried to integrate nicely with a number of different components which I was already familiar with within the rails environment like ActiveRecord. Having struggled a bit with the pure approach, I wouldn’t reccomend it.
Instead, what I’m doing is just spinning up an empty rails instance and just ignoring all the web based stuff. That is, I’m not spinning up a passenger instance, my app folder is empty but I can still access everything else inside Rails like:
- Migrations and rake tasks
- ruby script/console so I can interactively poke at the db
- ruby script/runner to spin up my server
- All the rails based testing frameworks
So even though it’s a bit more messy, it ends up saving a lot of hassle in the long run. So much for modular design huh?