119 Labs LLC

Ideas on Technology

Resolving Cucumber Gem Incompatibilities

I was trying to run cucumber with profiles under rails when I got the following error: “You have already activated builder 3.0.0, but your Gemfile requires builder 2.1.2. Consider using bundle exec. ” Looking into it this seems to be a common problem not just limited to builder.  Option #1 according to stack overflow is: bundle exec cucumber That works fine, but I was looking for something more concise.  Fortunately bundler comes with an option to help out. If you add the binstubs option to your install command it will create a directory bin in your rails root that contains all executables from gems that are installed. So after running: bundle install —-path .bundle/ —-binstubs I can run bin/cucumber —-profile wip from my rails root. Not bad, but I force of habit I kept just typing cucumber (which on my system is under /usr/bin) and I was back to square one. So the final step I edited the /usr/bin/cucumber file so that it detected the <rails_root>/bin/cucumber and ran it if it existed. Here’s the new /usr/bin/cucumber:   And that’s it. Now cucumber runs using the bundle environment if it exists, otherwise it falls back to default behavior.