Skip to content

Installing Bundler on Debian Lenny

jeffWelling edited this page Feb 6, 2011 · 1 revision

The newest TicGit-NG code uses Bundler to handle dependencies. Unfortunately, the current version of Debian Stable doesn't support Rubygems 1.3.7, which is required for Bundler. Do not be a complete goober and install rubygems as root; you will mess up your APT package management, and you will be very, very sorry later on. Just say no to super-user use of rubygems!

Installing Rubygems 1.3.7

Instead, here is the secret incantation needed to get Rubygems 1.3.7 installed in a user directory under Debian Stable. All commands can be entered directly on the command line, including comments, so you can just cut-and-paste the entire thing.

# Create a sensible rubygems environment in the user's home
# directory. With this setup, user-installed gems get preference,
# but you still have access to all your system gems as well.
export GEM_HOME="$HOME/gems/ruby1.8"
export RUBYLIB="$GEM_HOME/lib"
{ echo "$PATH" | fgrep -q "$GEM_HOME/bin"; } ||
    export PATH="$GEM_HOME/bin:$PATH"

# Remove RDoc dependency for gems. Some people report that RDoc
# isn't available even though it's part of the standard library.
string='gem: --no-ri --no-rdoc'
fgrep -q "$string" ~/.gemrc ||
    echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc

# Download and install rubygems-1.3.7 into the user's home
# directory.
mkdir -p "$GEM_HOME"
pushd $(mktemp -d)
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar xvfz rubygems-1.3.7.tgz
cd rubygems-1.3.7/
ruby setup.rb --prefix=$GEM_HOME
ln -s "$GEM_HOME/bin/gem1.8" "$GEM_HOME/bin/gem"

# Not strictly required, but this will save you a lot of heartache
# if you use gems regularly. It ensures rubygems is always loaded,
# without having to explicitly require it in each program or irb
# session.
echo 'export RUBYOPT=rubygems' >> ~/.bashrc

Now, copy and paste this into your .bashrc This ensures that you use the locally-installed version of rubygems every time you launch a new shell. If you've modified your .bashrc, you may need to tweak the location of this snippet so that it exports properly. export GEM_HOME=~/gems/ruby1.8 export RUBYLIB=$GEM_HOME/lib { echo "$PATH" | fgrep -q "$GEM_HOME/bin"; } || export PATH="$GEM_HOME/bin:$PATH"

Make sure you source .bashrc or open a new terminal for the changes to take effect. You can verify that you did everything right by typing

gem --version

and ensuring that the response is 1.3.7 instead of the 1.2.0 system default.

Installing Bundler

Once you have a newer rubygems installed, you can use rubygems-1.3.7 to install the bundler gem.

gem install --remote bundler

You should now be able to run any of the rake tasks defined for this project (gem install --remote rake will install rake if you don't already have it).

Notes

If you try to run one of the make commands, you may be presented with this; $ rake make (in /home/jeff/Projects/ticgit) You must run one of the bundle:install tasks first:

    rake bundle:install:all
    rake bundle:install:std
    rake bundle:show

If, after running one of the suggested commands (such as rake bundle:install:all), you try to run the desired rake command and are presented with the same prompt, this is the suggested work-around.

mkdir .bundle

Now try your rake command again and it should work.

Undoing These Instructions

Undoing this all is easy, remove GEM_HOME/bin from your PATH, and unset GEM_HOME in your environment. You can do all of that by commenting out any changes in your .bashrc file.

Clone this wiki locally