Alex Rivera | Logout

Bundler: how to use without rails?

Asked 2011-08-09T16:29:51.380
18

I have a project using cucumber outside of rails. How can I load the gems with the versions specified in my gemfile?

Edit
Report

1 Answer

26

Digging through the Bundler website:

  1. Create Gemfile (run bundle init to create skeleton Gemfile)
  2. bundle install
  3. In your app:

    # Only needed for ruby 1.8.x
    require 'rubygems'
    
    # The part that activates bundler in your app
    require 'bundler/setup' 
    
    # require your gems as usual
    require 'some_gem'
    
    # ...or require all the gems in one statement
    Bundler.require
    

Could be worth checking out:

Bundler.io - Using Bundler in Your Appplication
Bundler.io - Bundler.setup and Bundler.require

Are bundle exec and require 'bundler/setup' equivalent?

answered 2011-08-09T16:56:31.383

Your Answer