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

# Install any new gems that are compatible with your Gemfile
$ bundle update

Use 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:

# load the alias (all new shells will have the alias)
$ source ~/.bash_profile
$ be cucumber

Add Gemfile and Gemfile.lock to VCS

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

New version of Calabash or run-loop?

1. Update your Gemfile if necessary.
2. $ bundle update
3. $ be calabash-ios download
4. Rebuild your app
5. Test
6. Commit the new Gemfile, Gemfile.lock, and calabash.framework
Clone this wiki locally