Forum: Ruby Debian, gem(?) , and libraries

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-02-04 07:15
(Received via mailing list)
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
Michael T. (Guest)
on 2006-02-04 13:23
(Received via mailing list)
> 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/RailsOnUbu...

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

apt-get install rubygems

Michael T.
Stefan M. (Guest)
on 2006-02-04 13:32
(Received via mailing list)
removed_email_address@domain.invalid 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'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).

On Ubuntu I'm havin the following ruby packages installed via 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.
Stefan M. (Guest)
on 2006-02-04 13:32
(Received via mailing list)
Michael T. wrote:
> 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.
Manuel K. (Guest)
on 2006-02-04 15:05
(Received via mailing list)
Stefan M. schrieb:
> Michael T. wrote:
>>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.

Hello,
I have installed it from an unofficial repository here:

     deb http://www.sgtpepper.net/hyspro/deb unstable/ #rubygems

Works fine so far.
	Manuel
Gregory S. (Guest)
on 2006-02-04 19:11
(Received via mailing list)
On Sat, Feb 04, 2006 at 01:58:18PM +0900, removed_email_address@domain.invalid
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
unknown (Guest)
on 2006-02-05 17:05
(Received via mailing list)
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
Jim W. (Guest)
on 2006-02-05 19:15
unknown wrote:
> 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?

RubyGems only works for software explicitly packaged as gems.  Although
most Ruby authors make their packages available as a gem as an option,
not all do.  The gem command itself only searches the gem repository on
RubyForge by default, so it is possible that a gem is available for a
package and not show up with the gem list command.  Indeed, many
experimental or beta packages are available only one their own special
servers.

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

Download the package and read the README file.  Most ruby packages that
don't use gems will use either setup.rb or install.rb.  I took a brief
look at ropt, and it looks like you cat download the tar.gz file, and
untar it into a directory.  Then cd into that directory and type:

    ruby install.rb

If you are on a unix-like system, you probably need the appropriate user
privileges as well.

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

I've always like optparse that comes standard with Ruby.  Its not as
simple as ropt, but I really like the flexibility it gives me.

--
-- Jim W.
Meiao (Guest)
on 2006-02-06 03:09
(Received via mailing list)
I pretty much don't like Debian's packages for ruby.
I preferred to install everything by source.
unknown (Guest)
on 2006-02-06 22:36
(Received via mailing list)
[. . .]
> 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
Michael T. (Guest)
on 2006-02-07 02:05
(Received via mailing list)
That's where I got it as well
This topic is locked and can not be replied to.