fabien / minigems

Lighweight drop-in replacement for rubygems.

This URL has Read+Write access

fabien (author)
Mon Oct 20 14:58:31 -0700 2008
commit  2d81a25e2a42ee6519c9c4f4c6eb6a1683245c42
tree    36849c6d89a76412936dab1d3092bbd11ad10a9d
parent  5a30de87f43dd2f96e8911c1a2f5ccc42d1dabb0
name age message
file .gitignore Fri Aug 29 06:43:46 -0700 2008 Initial commit [fabien]
file CHANGELOG Mon Oct 20 14:58:31 -0700 2008 Misc. fixes to Gem activation [fabien]
file LICENSE Fri Aug 29 06:43:46 -0700 2008 Initial commit [fabien]
file README Wed Oct 01 04:04:21 -0700 2008 Refactored loading from source path and index [fabien]
file Rakefile Mon Oct 20 14:58:31 -0700 2008 Misc. fixes to Gem activation [fabien]
directory bin/ Fri Sep 19 06:33:37 -0700 2008 Fixed specs [fabien]
directory lib/ Mon Oct 20 14:58:31 -0700 2008 Misc. fixes to Gem activation [fabien]
file minigems.gemspec Sat Sep 20 09:15:04 -0700 2008 Adds gemspec for github [wycats]
directory spec/ Mon Oct 20 14:58:31 -0700 2008 Misc. fixes to Gem activation [fabien]
README
MiniGems
========

A lightweight drop-in replacement for rubygems to facilitate faster loading of
gems as well as reducing memory consumption considerably. Depending on the
amount of gems you have installed about 10-20 MB less RAM will be used, compared
to the full rubygems library version, which keeps a cache of all gems and files
referenced by them.

Minigems handles loading of required gems from your scripts. If however, other 
functionality is needed, the full rubygems library will be loaded automatically 
to continue normal operation.

You'll need to run 'sudo minigem setup' to get started; this will install
minigems.rb in your site_ruby directory, which makes it available to all your
ruby scripts.

MiniGems is enabled on a per-gem basis. To do so, you run 'minigem prepare', for
example, say we want the binary executables for merb-core (the 'merb' command)
to use minigems:

sudo minigem prepare merb-core

And to revert back to rubygems:

sudo minigem revert merb-core

To use minigems in your own scripts, use the following construct, instead of the 
common 'require "rubygems"' statement:

begin 
  require 'minigems'
rescue LoadError 
  require 'rubygems'
end

For best performance, use the Kernel#gem() method to load up the correct gem,
before doing any requires from it, preventing a more expensive glob operation.

The following:

require 'spec/task/spectask'

Can be easily improved as follows:

gem 'rspec'
require 'spec/task/spectask'

This is especially the case when there's no one-to-one mapping between the
file to require and de gem name (spec vs. rspec in the example above).

There's currently a patch pending on RubyForge, to get minigems into the 
standard, rubygems system. If you like minigems, please post a vote/followup:

http://rubyforge.org/tracker/?func=detail&atid=577&aid=21979&group_id=126