Search the web
Sign In
New User? Sign Up
rubyonrails-nyc · RubyOnRails NYC
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Call for help/comments on a gem project   Message List  
Reply | Forward Message #28 of 55 |
Hi All,

Here's what I'm planning on working on tonight - if anyone else thinks
this is worth doing, I could definitely use some help...

("You're doing it all wrong" is perfectly valid help, as long as you
tell me how to do it right!)

In the spirit of the rake 'freeze_rails' and 'unfreeze_rails' tasks, I
will be working on implementing freeze_gem/unfreeze_gem.

== Why? ==

You want to use a gem in your rails application but you don't have
full 'gem install' access to either your local machine or your
eventual deployment machine.

== What? ==

freeze_gem will unpack the specified gem into
RAILS_ROOT/vendor/frozen_gems (unfreeze_gem removes it).

== How? ==

So far, what I've sketched out is:

Given usage: `freeze_gem GEMNAME` in RAILS_ROOT

1. Check to see if GEMNAME is installed locally

2. If yes, go to 3, else `gem install GEMNAME --install-dir=/tmp`, set
GEM_HOME to /tmp

3. `mkdir vendor/frozen_gems` if necessary, `cd vendor/frozen_gems`

4. `gem unpack GEMNAME`

== Loading Frozen Gems ==

Running freeze_gem also installs the 'frozen_gem_loader' plugin if
necessary. The frozen_gem_loader plugin is something like:

frozen_gem_loader/init.rb

unless Object.const_defined?(:Gem)
require 'rubygems'
end

Dir.glob("#{RAILS_ROOT}/vendor/frozen_gems/*") do |directory|
next if File.basename(directory)[0] == ?. || !File.directory?(directory)

if File.directory?("#{directory}/lib")
$LOAD_PATH.unshift "#{directory}/lib"
end

$LOAD_PATH.uniq!
end

== Some Complications ==

- Gem versions: there should really only be one version of any
particular gem frozen at any one time.
- Platform issues: it really only makes sense to freeze pure ruby
gems. Is it possible to determine if a gem is pure ruby or not?
- Dependencies: things get a lot more complicated if multiple
dependencies have to be installed and frozen.


--ryan

--
Ryan Raaum
http://www.rockefeller.edu -- Bacterial Pathogenesis and Immunology
http://www.worldmartial.com -- Black Belt Instructor
http://locomotive.sourceforge.net -- Self contained one-click Rails for Mac OS X



Tue Nov 8, 2005 8:12 pm

ryanraaum
Offline Offline
Send Email Send Email

Forward
Message #28 of 55 |
Expand Messages Author Sort by Date

Hi All, Here's what I'm planning on working on tonight - if anyone else thinks this is worth doing, I could definitely use some help... ("You're doing it all...
Ryan Raaum
ryanraaum
Offline Send Email
Nov 8, 2005
8:14 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help