10 months ago
I made some updates and changes to Pulp tonight. For those not aware, Pulp is a little shell script and accompanying package of assets to generate a base MVC-structured Sinatra application and front-end boilerplate. I use it a lot for small web apps that don’t need the robustness of something like Rails, or I will often dump the views and public folders and use it as a base from which to build REST APIs.
Anyway, on to the updates:
I swapped out DataMapper for ActiveRecord - I guess this is the most “controversial” change. ActiveRecord has a lot more overhead than DataMapper and the philosophy behind each is a bit different, but I also think ActiveRecord is a bit more mature and I prefer its migrations over both the built-in DataMapper migrations, and the ones available via the dm-migrations gem. I gave DataMapper a good try. I didn’t hate it. In fact, I liked it a lot and still use it on a lot of production code (like HappyDocs), but it turns out to be less maintainable on larger applications, and not all Sinatra apps are tiny. Some APIs can get pretty complex.
I changed the way tests are generated - They now go in their own directory.
I added a Rakefile and a couple of custom tasks - Including db:reset which truncates all tables in your database, except for the schema_migrations table.
I added code statistics - This serves to satisfy curiosity more than anything else. I pulled in the code_statistics.rb file form Rails and modified it slightly to work with Pulp’s particular structure (though I just realized a moment ago that it currently doesn’t gather stats on the application file itself).
I changed how configs are done - They’re now in a JSON file organized by the production environment, so you can have different configurations for development, test, and production.
I included the Pony gem and config options for it - This little gem is super handy and makes sending email really simple. I decided sending email was a common enough task to go ahead and include it in the boilerplate.
I think that’s everything.