Debian, gem(?) , and libraries

F

furufuru

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.

Regards,
Ryo
 
M

Michael Trier

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.

RubyGems is a separate packaging system that doesn't cause any
conflicts with Debian's package system (apt). RubyGems, for me, tends
to work extremely well and I use it often.

As far as getting it installed, there's the documentation on the Wiki site:

http://wiki.rubyonrails.com/rails/pages/RailsOnUbuntuDebianTestingAndUnstab=
le

My approach was slightly different. Instead of building from source I
just to them through apt:

apt-get install rubygems

Michael Trier
 
S

Stefan Mahlitz

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'm using gems on Ubuntu (and were using it on debian as well).

You will have to manually install rubygems from source, but this will be
easy, after installing ruby-dev (with aptitude).

i A libreadline-ruby1.8 - Readline interface for Ruby 1.8
i A libruby1.8 - Libraries necessary to run Ruby 1.8
i ruby - An interpreter of object-oriented scriptin
i ruby1.8 - Interpreter of object-oriented scripting l
i ruby1.8-dev - Header files for compiling extension modul
Rubygems:
*** LOCAL GEMS ***

coverage (0.3)
identifies inactive code

sources (0.0.1)
This package provides download sources for remote gem installation

This is an example for a library that is not available as a Debian package.

Debian packages on the other hand need to pass some procedure to be
included in the stable or testing branch, so it could take some time for
new libraries to show up.

Rubygems and debian packages are independent (they don't know about each
other), be careful if you both install a library via rubygems and debian
package management (should be: don't do this).
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.

There is http://raa.ruby-lang.org/ as well, but I haven't used it.

Using rubygems is working fine for me.
 
S

Stefan Mahlitz

Michael said:
My approach was slightly different. Instead of building from source I
just to them through apt:

apt-get install rubygems

What is in your sources.list - the package doesn't show up.
 
G

Gregory Seidman

On Sat, Feb 04, 2006 at 01:58:18PM +0900, (e-mail address removed)-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 <destination dir>" >&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 <<EOF >&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
 
F

furufuru

Thank you all who responded.

I suceeded in installing rubygems in /usr/local/bin
by a method along the lines Gregory suggested.
But after that, I switched to the unofficial Debian package
Manuel mentioned.

Now, my original purpose at hand was to install
a command-line argument parser. By searching
the Internet, I had learned there are getopt, getoptlong,
optparse (parseopt??), and ropt. (Sorry if I misspelt some
of them). Reading some documents, I decided I like the
simplicity of ropt. But then, "gem search opt --remote"
listed getopt, getopt-declare, and OptionParser.
Not ropt. Argh.

1) Does the gem system work for those libraries which
aren't shown in the listing? In other words, if the gem
command doesn't show a library, would you need to
install it separately from the gem framework?

2) How do you install ruby libraries which are not on
the gem framework?

3) Which command line argument parser is "standard"?
(Please user your own definition of "standard" :)

Thank you,
Ryo
 
M

Meiao

I pretty much don't like Debian's packages for ruby.
I preferred to install everything by source.
 
F

furufuru

[. . .]
2) How do you install ruby libraries which are not on
the gem framework?

I went ahead and installed ropt. It came with
an installation script:

$ ruby install.rb config
$ ruby install.rb setup
# ruby install.rb install

Then it installed (copied) the library
to /usr/local/lib/site_ruby/1.8/ (I hope I rememer
correctly. The machine is at home). This is the
same directory as gem manages, I think. Is this what
people normally do?

I think this is OK, until the files installed
outside the gem framework conflict with those in
the gem archive.

Ryo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top