Giter Club home page Giter Club logo

minigems's Introduction

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

minigems's People

Contributors

fabien avatar wycats avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.