zengr zengr - 6 months ago 3
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".


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"])