Sinatra + Bundler?

Viewed 16874

I'm wondering how one can use Bundler with Sinatra. The idea is to use the gems that Bundler downloads inside the .gems folder.

5 Answers

+1 for the guide on the bundler website, but if you have a simple app and use Sinatra's dsl at the top level, then you need to do the following:

in your Gemfile (tell bundler not require sinatra):

gem 'sinatra', :require => false

and in the app's file (explicitly require sinatra):

require 'rubygems'
require 'bundler'
Bundler.require
require 'sinatra'

get '/' do
  'hello world'
end
Related