2

I am using bundle to install all the needed gems into a local folder for the ease of development and testing

 bundle install --path vendor/bundle

And I can find libs are being installed under the folder "vendor/bundle", but how to tell my ruby to use that folder as well?

e.g. When I start my program in the shell

/Users/howard/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- yajl (LoadError)

But yajl is under the folder /vendor/bundle/ruby/1.9.1/gems/yajl-ruby-1.1.0/

Howard
  • 19,215
  • 35
  • 112
  • 184

2 Answers2

4

This is too obvious, but just in case... Did you try:

bundle exec your_script.rb
jaeheung
  • 1,208
  • 6
  • 7
1

Simply install the bundle or create a gemset. then try.

Sami
  • 1,041
  • 3
  • 16
  • 32
  • my point is I don't want to mix the gem with the currently system intalled one, I want them under the vendor/bundle. But I need to find a way to load them during my ruby script started. – Howard Aug 17 '13 at 08:01
  • have you tried this http://lostechies.com/derickbailey/2011/02/24/how-to-have-bundler-load-a-custom-gem-into-a-rails-3-app/ http://stackoverflow.com/questions/18168341/library-not-loaded-error-wrong-ruby http://stackoverflow.com/questions/12573596/what-is-the-purpose-of-vendor-bundle-heroku-tells-me-to-remove-it – Sami Aug 17 '13 at 09:17