set openshift bundle_without variable

Mar 2, 2015

I spent far too long trying to figure out how to set OpenShift’s BUNDLE_WITHOUT variable to limit the gems installed on my OpenShift container.
I searched far and wide through OpenShift’s documentation for information on how to do so.
At the time, the small amount of relevant helpdoc that existed turned out to not be particularly helpful, or I was doing something wrong.
There is some OpenShift doc explaining that you can set environment variables using the following command from the rhc tool.

rhc env set BUNDLE_WITHOUT='development test' --app 'maprys'

I could’ve done that, I guess, but I didn’t want to.
I do most of this site’s coding on Nitrous.io and some stubborn part of me didn’t want to eat up disk space with the rhc tool.
Pedantic, probably.

Anyways, I figured out a way to set environment variables without having to use the rhc tool.
I can checkout the code from anywhere, change/add/remove variables, and I don’t have to install an additional tool to do so.
You should already have a .openshift directory with some stuff in there.
Create .openshift/action_hooks/pre_build and open it in your favorite editor.
Inside, you’ll want to paste the following code.