From: Gordon Thiesfeld Date: 2009-08-06T16:33:29+09:00 Subject: Re: including gems with standalone app On Wed, Aug 5, 2009 at 5:12 PM, Eric Peterson wrote: > Morning, > >  I have a situation where I do not have the ability to add gems into > production.  I can provide a ruby script to be ran by the Operations > Team, but I can't ask that they install a gem I use.  Also, stuck at > Ruby v.1.8.5. > >  Is it possible to 'package' a gem into a directory structure with my > app?  For example: > > \ >  app.rb >  config.yml >  README.txt >  ... >  \gem >    \fastercsv >    ... >    \ruby-sqlite3 >    ... >  \lib >    \sqlite3 >    ... > >  How would I go about telling my app to use these gems in my directory > structure and not any that might happen to be available in the system > (or not)?  Then I could zip up the whole directory, send to operations, > where they would install this app and run according to instructions. > >  I hope I described this right.  If not let me know how I can add to > this confusion. :) > I'm not sure if it's the best way, but you could manipulate ENV['gem_home'] from your script. C:\>cd myapp C:\myapp>gem list fastercsv *** LOCAL GEMS *** # fastercsv not installed C:\myapp>type myapp.rb ENV['GEM_HOME'] = './gem' require 'rubygems' require 'fastercsv' C:\myapp>gem in fastercsv -i gem #install fastercsv inside app/gem folder Successfully installed fastercsv-1.5.0 1 gem installed Installing ri documentation for fastercsv-1.5.0... Installing RDoc documentation for fastercsv-1.5.0... C:\myapp>dir /b gem cache doc gems specifications C:\myapp>ruby myapp.rb