zengr zengr - 1 year ago 68
Ruby Question

How to freeze gems in a Ruby application?

I need to freeze two gems and make my project refer to those gems from its project folder.

I know many ways to do it in Rails, but how do I do it manually in Ruby?

I am using jeweler based on advice from my previous question "Starting a Ruby project: github + build tool".

Answer Source

You could use them independently of the rubygems infrastructure by first unpacking each gem into vendor/gems (or whatever path within your project):

cd yourapp
mkdir -p vendor/gems
cd vendor/gems
gem unpack gem1
gem unpack gem2

... and then adding all the frozen gems' lib directories into your load path:

$:.unshift(*Dir[File.dirname(__FILE__) + "/vendor/gems/**/lib"])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download