Project

gemenv

0.0
No commit activity in last 3 years
No release in over 3 years
Gemenv provides a container for your gems, and otherwise stays out of your way.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

gemenv

A tool for managing gem environments.

Introduction

gemenv is a tool to build rubygem environments, in the spirit of Python's virtualenv. It creates a directory with a complete GEM_HOME to contain all of your project's gems. It also contains an activation script to enable this environment, and an executor to run subshells (or anything else) with the right environment variables set.

Here's an example session:

$ cd /tmp
$ gemenv my-new-env
$ ls my-new-env
bin/ gem_home
$ source my-new-env/bin/activate
$ gem install rake
Fetching: rake-10.0.3.gem (100%)
Successfully installed rake-10.0.3
1 gem installed
Installing ri documentation for rake-10.0.3...
Installing RDoc documentation for rake-10.0.3...
{gemenv:my-new-env}
$ ls my-new-env/gem_home/gems
rake-10.0.3
$ which rake
/tmp/my-new-env/gem_home/bin/rake
$ echo $VIRTUAL_ENV
/tmp/my-new-env

You can see that sourcing the activate script does three things:

  1. It sets GEM_HOME so that gem installations go into the environment, not your home or system GEM_HOME
  2. It adds the GEM_HOME bin/ directory to your $PATH so that gem-installed binaries are available.
  3. It adds a VIRTUAL_ENV environment variable that you can strap into PS1 if you wish.

This is (almost) all it does. There is currently no way to deactivate a gemenv environment activated by bin/activate. If you want a deactivatable environment, use bin/exec:

$ my-new-env/bin/exec /bin/bash

Anything which respects GEM_HOME should work with gemenv, so you can, for instance, use bundler to install gems into a gemenv.

The activation script currently overwrites GEM_PATH, so gemenv does not currently support "global" gems.

-- Alex Young alex@bytemark.co.uk