Datamapper

Installing the DataMapper gem with Postgres.app

Another install-related entry. This time, I’m attempting to install the Ruby Gem, DataMapper, for a small project - a mini app for pulling S3/Cloudfront download stats for my Verbose (iTunes link) podcast. The app pulls a date range worth of logs from S3, then digests the logs, putting the relevant data into a Postgres database, so they can be mangled at will later. 

I’ve installed Postgres.app on my MacBook Air, because I like the icon. I could have homebrew‘ed the database in, but since I don’t use it that often, it’s trivial to remove when bundled into the app. DataMapper has worked well for me in the past, so I’m sticking with it.

The whole reasoning behind using Postgres in the first place is that both AppFog and Heroku support it as their default SQL database. There’s no performance constraints, or scaling requirements here, since this is just a tiny, personal app. The main technology consideration is get-out-of-my-way-and-let-me-get-this-done-for-cheap.

But there’s always something. In this case it’s installing a Ruby gem with native extensions, when the collateral for building those extensions resides in a non-default location. 

Image

 

Making the install work involves using bundle config, an aspect of Bundler I didn’t know about. It allows you to override the arguments to the configure execution for native gem components. You can directly override when installing a gem, or you can register an override that will be stored in your ~/.bundle directory and remembered for future use. 

Here’s the incantation that worked for me, for a once-off install:

gem install do_postgres – <br />     –with-pgsql-server-dir=/Applications/Postgres.app/Contents/MacOS <br />     –with-pgsql-server-include=/Applications/Postgres.app/Contents/MacOS/include/server