views:

272

answers:

0

I am having trouble configuring Sinatra to use Bundler. I am confused as to where Gems should be being installed? I've read both this question and this documentation.

My Gemfile looks like:

source "http://rubygems.org"
gem "sinatra"
gem "amazon-ec2"

My config.ru looks like:

require "rubygems"
require "bundler"
Bundler.setup
require "application"
run Sinatra::Application

My application.rb looks like:

require "rubygems"
require "sinatra"
require "AWS"

#... rest of application

Now, when I run bundle install everything works correctly and Gems get installed into ~/.bundle/ in my home directory. Yet, in my app if I have a look at .bundle/config it shows:

--- 
BUNDLE_WITHOUT: ""
BUNDLE_PATH: vendor/gems

Sure enough, when I start up the app (using Passenger by the way) it says:

Could not find gem 'amazon-ec2 (>= 0, runtime)' in the gems available on this machine. (Bundler::GemNotFound)

Clearly bundle install is installing Gems in a different place to where Sinatra expects them to be. Does that mean I have to use bundle install vendor or reconfigure something else so that the application expects the Gems to be in ~/.bundle?