Skip to content

Instantly share code, notes, and snippets.

@sent-hil
Created August 22, 2012 08:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sent-hil/3423695 to your computer and use it in GitHub Desktop.
Save sent-hil/3423695 to your computer and use it in GitHub Desktop.
River (getriver.com): Gemfile and Bundler best practices.

This is my current Gemfile for River.

source 'http://rubygems.org'

gem 'god' # monitoring of Goliath & Sinatra apps

group :default do
  gem 'yajl-ruby', :require => 'yajl' # fast JSON dumping/parsing
end

group :api do
  gem 'em-mongo' # evented connection to MongoDb
  gem 'bson_ext' # C extension for faster MongoDb
  gem 'goliath'  # framework for evented apps
end

group :web do
  gem 'sinatra' # simple framework
  gem 'mongo'   # non-evented connection to MongoDb
end

group :development do
  gem 'shotgun'      # automatically reload sinatra between requests
  gem 'pry'          # irb replacement
  gem 'pry-debugger' # ruby-debugger replacement
  gem 'pry-remote'   # connect to daemonized ruby processes
end

group :test do
  gem 'em-http-request' # req. for Goliath test
  gem 'json_spec'       # test JSON strings easily
  gem 'mongo'           # use regular mongo in specs, so its easier to test
  gem 'rspec'           # BDD testing tool
end

The gems are organized into groups, making it easier to require only the appropriate gems for each part. For example, the api's lib/dependencies.rb file looks like:

require 'bundler/setup'
Bundler.require(:default, :api)

require 'em-synchrony/em-mongo'

Make sure to read http://gembundler.com/rationale.html, it has detailed info on how to use Bundler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment