Last Updated: February 25, 2016
·
765
· hopsoft

A Gemfile that works for Heroku's Cedar stack

Anyone deploying Ruby apps to Heroku's Cedar stack has to deal with the fact that it doesn't support the BUNDLE_WITHOUT config setting.

I got tired of commenting groups in the Gemfile and re-bundling prior to pushing to Heroku.

Here's how I made life a bit easier.

Gemfile

if ENV["BUNDLE_DEV"] == "true"
  group :development do
    gem "pry"
    # more gems ...
  end
end

I also set BUNDLE_DEV=true in ~/.bashrc

Then I created this simple script that I run prior to all commits.

script/bundle_heroku

#!/usr/bin/env bash --
BUNDLE_DEV=false bundle
BUNDLE_DEV=true

Here is an example of my workflow now.

  • git pull
  • bundle
  • make changes
  • script/bundle_heroku
  • git commit -a