From: Gregory Seidman Date: 2006-02-05T02:09:41+09:00 Subject: Re: Debian, gem(?) , and libraries On Sat, Feb 04, 2006 at 01:58:18PM +0900, furufuru@ccsr.u-tokyo.ac.jp wrote: } Hello all, } } I'm using Ruby on Debian GNU/Linux. Ruby itself } and its standard library were installed as Debian } packages. Now, I want to add Ruby libraries } which aren't standard part of Ruby. What do } people do? I heard of "rubygem". Is it a packaging } system for Ruby? How does it interact with the } packaging system of Debian? } } I could just download the sources of those libraries } and install them under ~/lib/ruby or /usr/local/lib/ruby } or some such places. But, I guess there are better, } more organized, and standard ways. I spent a fair amount of time making RubyGems install properly into /usr/local/bin on Debian and keep itself there. By default, unfortunately, it really wants to install gems in /usr/lib regardless of where it has been installed. To work around this shortcoming, I've developed an install script for RubyGems. It isn't Debian-specific, but it certainly works well on Debian. The script follows. PAY ATTENTION TO THE MESSAGE AT THE END! } Regards, } Ryo --Greg #!/bin/sh if test $# -ne 1 then echo "Usage: $0 " >&2 exit 1 elif test ! -r setup.rb then echo "Please run from the toplevel RubyGems source directory" >&2 exit 2 fi GEM_HOME="$1/lib/site_ruby/gems" export GEM_HOME if test -d "$GEM_HOME" then cat <<-EOF >&2 The GEM_HOME directory already exists. Overwriting an existing install will not work well. If you intend to reinstall, please first remove $GEM_HOME EOF exit 3 elif ! mkdir -p "$GEM_HOME" then cat <<-EOF >&2 You do not have permission to install in the directory selected. Perhaps you meant to install as root? EOF exit 4 fi while test ! -e "$GEM_HOME/bin" do echo -n "Where should executables be installed [$GEM_HOME/bin]? " >&2 read dest if test "$dest" = "" -a "$dest" = "$GEM_HOME/bin" then dest="$GEM_HOME/bin" mkdir "$dest" elif test -d "$dest" then ln -s "$dest" "$GEM_HOME/bin" else echo "You must choose an existing directory." >&2 fi done ruby setup.rb config --prefix="$1" --siteruby=\$prefix/lib/site_ruby && \ ruby setup.rb install cat <&2 ################################################################################ Be sure to set the GEM_HOME environment variable in your shell's init/config file to '$GEM_HOME' For Bourne shell derivatives, add the following lines to your ~/.profile or the system-wide /etc/profile: GEM_HOME="$GEM_HOME" export GEM_HOME For C shell derivatives, add the following line to your ~/.cshrc (or ~/.tcshrc) or the system-wide /etc/csh.cshrc: setenv GEM_HOME "$GEM_HOME" ################################################################################ EOF