Skip to content

Best Practice: Use Gemfile and bundler

Joshua Moody edited this page Sep 25, 2015 · 7 revisions

Use bundler

We do.

What is bundler?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. [1]

Example Gemfile

source 'https://rubygems.org'
gem 'run_loop', '>= 1.5.5', '< 2.0'
gem 'calabash-cucumber', '>= 0.16.3'

Update the Gemfile.lock to get the most recent versions of the gems.

$ bundle update

Execute all ruby command in the context of 'bundle exec'

$ bundle exec calabash-ios console
$ bundle exec calabash-ios download
$ bundle exec calabash-ios sim reset
$ APP=/path/to/your.app bundle exec cucumber

For convenience, add this to alias to your ~/.bash_profile.

alias be='bundle exec'

Then use:

$ be cucumber

Add your Gemfile and Gemfile.lock to version control

All members of your team will be working with the same gem environment.

# Fetch the latest changes
$ git pull ...

# Install any new gem versions
$ bundle install

# Run with bundle exec
$ be cucumber
Clone this wiki locally