Ruby gems, and the require problem (was Re: RAA Status & b)

//> +10
//> [snipped a lot of good & practical justifications]
//>
//> but i think what you are asking is rpa :slight_smile:
//
//Maybe, rpa without the admin overhead,

if one needs quality, one needs an admin :slight_smile:
i am quality sensitive, especially since i'm introducing ruby in my company.
If you think about it, the admin is there to _ease_ your job. Quality
packaging is not easy.

// where anything on RAA
//can be installed with it.

ah, rubygems at rubyforge would do fine.

but then again, who would port all those raa pckages to rubyforge/gems? An
admin again, perhaps?

kind regards -botp

//
//Cheers,
//Sam
//

···

Sam Roberts [mailto:sroberts@uniserve.com] wrote:

Quoting botp@delmonte-phil.com, on Fri, Mar 04, 2005 at 12:21:01PM +0900:

//> +10
//> [snipped a lot of good & practical justifications]
//>
//> but i think what you are asking is rpa :slight_smile:
//
//Maybe, rpa without the admin overhead,

if one needs quality, one needs an admin :slight_smile:

Sometimes you don't need quality.

Sometimes I need to be able to release my project, post to my mailing
list, and have my users run "favetool -get sam'sproject", and have it
work, now, whether an admin has had the time to look at my project, and
even if the project is alpha and sucks right now.

If after it is good the RPA folks want to bless it, thats great, then
you can use it at your company with an assurance of quality.

// where anything on RAA
//can be installed with it.

ah, rubygems at rubyforge would do fine.

but then again, who would port all those raa pckages to rubyforge/gems? An
admin again, perhaps?

Well, isn't all the info in RAA sufficient to install a project?

If I can go to RAA with my web browser, go to a project page, hit the
download link, tar -xzf proj.tgz; cd proj; ruby setup.rb install...

... maybe a script could do this?

The only reason a script couldn't is that the naming conventions aren't
strong enough (some folks use setup.rb, some use install.rb), etc.

The gem tool (and rpa, I assume) when it packages something up, what it
is really doing is enforcing a structure, so tools can work with it.
This is cool.

The way I see it is:

- gems is a nice packaging system, with the unacceptable overhead of
   a poorly considered versioning system

- rpa is a nice packaing system, with the unacceptable overhead of
   an external evaluation process

If you could post .rpa somewhere, and the admin team could bless some
subset later, at their leisure and discretion, I'd be happy.

If gems didn't require me to change my ruby code, or hack my
environment, I'd be happy.

So close to happiness....

Cheers,
Sam

···

Sam Roberts [mailto:sroberts@uniserve.com] wrote:

I thought for a while if we had a...

gem deploy (list of gems or --all)

...which deploys all the (ruby/native) libraries in the gems into a central
dir (like the standard /usr/local/lib/ruby/site_ruby/1.8 or something) then
you could have the normal 'require' stuff just work (removing gems from the
runtime) and making it just a deployment system. What do you think?

You could even have sets of gems based on a quality estimation (or version
compatibility) that would give you an RPA style check w/out the packaging by
a central entity.

-rich

···

On 3/3/05 10:35 PM, "Sam Roberts" <sroberts@uniserve.com> wrote:

The gem tool (and rpa, I assume) when it packages something up, what it
is really doing is enforcing a structure, so tools can work with it.
This is cool.

The way I see it is:

- gems is a nice packaging system, with the unacceptable overhead of
   a poorly considered versioning system

- rpa is a nice packaing system, with the unacceptable overhead of
   an external evaluation process

- gems is a nice packaging system, with the unacceptable overhead of
   a poorly considered versioning system

- rpa is a nice packaing system, with the unacceptable overhead of
   an external evaluation process

If you could post .rpa somewhere, and the admin team could bless some
subset later, at their leisure and discretion, I'd be happy.

You can! It's not well documented yet, but quite possible. The rpa tool
certainly can download from any arbitrary URL.

Ari

Quoting botp@delmonte-phil.com , on Fri, Mar 04, 2005 at
12:21:01PM +0900:

+10
[snipped a lot of good & practical justifications]
but i think what you are asking is rpa :slight_smile:

Maybe, rpa without the admin overhead,

if one needs quality, one needs an admin :slight_smile:

Sometimes you don't need quality.

Sometimes I need to be able to release my project, post to my
mailing list, and have my users run "favetool -get sam'sproject",
and have it work, now, whether an admin has had the time to look
at my project, and even if the project is alpha and sucks right
now.

Right. And that will be RubyGems, plain and simple. RubyGems is
scheduled to make it into the core -- once it's of high enough
quality.

where anything on RAA can be installed with it.

ah, rubygems at rubyforge would do fine.

but then again, who would port all those raa pckages to
rubyforge/gems? An admin again, perhaps?

Well, isn't all the info in RAA sufficient to install a project?

No.

This was tried a couple of years ago, and to put it bluntly, the
result sucked. It didn't run at all on a Win32 installation, and it
was hit-and-miss because there were no packaging standards at all.
Yes, there was setup.rb, but different people had different versions
that did different things. Worse, the RAA is actually better named
the RAI (Ruby Application Index), as it doesn't host anything. If
the webpage is down, then the package is uninstallable. Oops. This
is worst on personal homepages.

To this day, for my .tar.gz releases, I maintain my *own* install.rb
(and it's *good*, but it's only good for pure Ruby solutions); I'll
only switch to setup.rb or something like that if I ever need an
extension.

RubyGems solves most of this, and it solves it without much work by
the developer.

One of my unfinished projects is a Package Publisher tool that will
take your package directory, create a gem and a .tar.gz (using
Archive::Tar::Minitar), optionally digitally sign it, release it on
RubyForge (if appropriate) and update your package details on the RAA.

It got stuck on the uploading part, and then I had other projects to
work on by time I figured out the uploading part (actually, Patrick
May did).

Look at my post in the original thread (I think). It's closer than
you think, and Matz *has* indicated that a packaging system should
be in the core. This will probably be RubyGems as it is the furthest
along.

-austin

···

On Fri, 4 Mar 2005 12:35:29 +0900, Sam Roberts <sroberts@uniserve.com> wrote:

Sam Roberts [mailto:sroberts@uniserve.com ] wrote:

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

* Richard Kilmer <rich@infoether.com> [2005-03-04 12:47:34 +0900]:

I thought for a while if we had a...

gem deploy (list of gems or --all)

...which deploys all the (ruby/native) libraries in the gems into a central
dir (like the standard /usr/local/lib/ruby/site_ruby/1.8 or something) then
you could have the normal 'require' stuff just work (removing gems from the
runtime) and making it just a deployment system. What do you think?

I'll vote for that. ++1

Or, more likely

  sudo gem deploy (list of gmes or --all)

This would make gems a great test bed. If you like it,
then put it into the system...

This should involve a relatively simple copy, right?

···

--
Jim Freeze
Code Red. Code Ruby

Quoting rich@infoether.com, on Fri, Mar 04, 2005 at 12:47:34PM +0900:

>
> The gem tool (and rpa, I assume) when it packages something up, what it
> is really doing is enforcing a structure, so tools can work with it.
> This is cool.
>
> The way I see it is:
>
> - gems is a nice packaging system, with the unacceptable overhead of
> a poorly considered versioning system
>
> - rpa is a nice packaing system, with the unacceptable overhead of
> an external evaluation process
>

I thought for a while if we had a...

gem deploy (list of gems or --all)

...which deploys all the (ruby/native) libraries in the gems into a central
dir (like the standard /usr/local/lib/ruby/site_ruby/1.8 or something) then
you could have the normal 'require' stuff just work (removing gems from the
runtime) and making it just a deployment system. What do you think?

Would be a work-around, and I'm afraid it is oriented at the installer
of gems, so speaking as a library packager, it doesn't solve my
problems.

The command line tools I make that use my libraries, they do a
"require", only. If "deployment" doesn't occur, and its an optional
second step, the gem users who don't do the

  gem deploy net-mdns

are going to be coming back to me and asking why my mdns.rb script won't
find net/mdns. IMHO, if deploy doesn't always occur, it still leaves me
with having to maintain different versions of scripts and libraries -
gem using, and non-gem using.

Why isn't the entire versioning thing optional? I know I'm not the only
person who doesn't like it.

As I understand it, the real benefit to keeping the installs out of the
main tree is that it makes it easy to uninstall, not that it allows
versioning. Uninstall is very important, but there are other ways of
dealing with that.

The versioning behaviours of gems should be optional, and your deploy
should be standard. If folks need different rails installs, and they
want to use gems in their apps then they know what they are doing, they
should do a

  gem install --versioned

and make sure they do a

  require 'ruby_gems'
  require 'rails', 0.13
  
at the top of their scripts.

Likewise, people who do a gem install --versioned of my libraries
(net-mdns or vPim) will KNOW that my mdns.rb script won't work out of
the box for them, they are going to have to do something to make the
scripts use the particular version - but they deliberately installed
like this, they know what the workarounds are, and why they are doing
it.

Versioning is a special case, it should be treated as such.

You could even have sets of gems based on a quality estimation (or version
compatibility) that would give you an RPA style check w/out the packaging by
a central entity.

I know the rpa and gems team are friendly, so I assume that the RPA guys
real goal is a coherent set of packages. I wonder it they might not
adopt the gem package format if there was a way for them to have a named
set of gems as a "coherent version", or whatever they are looking for?
Particularly if it didn't have the versioning/API change problem?

I have the impression the rpa tool was developed as a side effect, their
primary goal was producing a stable, tested, library distribution.

Sam

···

On 3/3/05 10:35 PM, "Sam Roberts" <sroberts@uniserve.com> wrote:

No...they need to get your library:

gem install net-mdns

And if they have RUBYOPT=rubygems

Their code looks like:

require 'net/mdns'

If they don't have the RUBYOPT, or don't want it, they can do:

gem deploy net-mdns

Or even more concise to download and deploy:

gem install net-mdns --deploy

With the --deploy option able to be set in the .gemrc or something.

The thing is you assume they install your net-mdns in site_ruby which may
not be what folks want. You need to have two steps...get the
library...deploy it in some directory that is in the $: path. This is the
same thing that setup.rb does (deploy into a dir...site_ruby default) Having
the RUBYOPT makes the deployment happen kinda magically at runtime as you
need it. The extra deploy step lets you do it without the magic runtime
require hack stuff. But the ability to target where to deploy (like --dir
my_test_dir) makes it rather powerful in that you can have lots of site_ruby
like dirs that hold sets of deployed gem libraries (.rb/.so) and $:.unshift
them for testing, etc.

Anyway, its a thought.

-rich

···

On 3/3/05 11:53 PM, "Sam Roberts" <sroberts@uniserve.com> wrote:

Would be a work-around, and I'm afraid it is oriented at the installer
of gems, so speaking as a library packager, it doesn't solve my
problems.

The command line tools I make that use my libraries, they do a
"require", only. If "deployment" doesn't occur, and its an optional
second step, the gem users who don't do the

  gem deploy net-mdns

are going to be coming back to me and asking why my mdns.rb script won't
find net/mdns. IMHO, if deploy doesn't always occur, it still leaves me
with having to maintain different versions of scripts and libraries -
gem using, and non-gem using.

Quoting rich@infoether.com, on Fri, Mar 04, 2005 at 02:11:16PM +0900:

> Would be a work-around, and I'm afraid it is oriented at the installer
> of gems, so speaking as a library packager, it doesn't solve my
> problems.
>
> The command line tools I make that use my libraries, they do a
> "require", only. If "deployment" doesn't occur, and its an optional
> second step, the gem users who don't do the
>
> gem deploy net-mdns
>
> are going to be coming back to me and asking why my mdns.rb script won't
> find net/mdns. IMHO, if deploy doesn't always occur, it still leaves me
> with having to maintain different versions of scripts and libraries -
> gem using, and non-gem using.

No...they need to get your library:

gem install net-mdns

And if they have RUBYOPT=rubygems

They don't, so the script won't work.

Their code looks like:

MY CODE. IT'S MY CODE. Argh.

I wrote the script, I put it in the package, and I have to make two
versions of it, one assuming that my package was installed with ruby
gems in default mode, the other assuming ruby gems wasn't used or that
the user did "gem deploy".

gems has created two distinct dialects of ruby, one uses ruby's require,
and the other uses the gems require, of the same name. Code written in
ruby's dialect won't work with gems without hacking the code, or hacking
the environment.

Code written with the require_gems won't work for people who don't have
gems, even if they have the libraries.

Its a language split. It's a problem.

Having to set 'magic' environment variables or hack the code or command
line is a problem, not a fix.

require 'net/mdns'

If they don't have the RUBYOPT, or don't want it, they can do:

[snip] complex work arounds for a problem that should not have been
caused

The thing is you assume they install your net-mdns in site_ruby which may
not be what folks want. You need to have two steps...get the

NO. I don't assume they install in site_ruby, I assume they install
somewhere where ***ruby's require can find it***.

That can be anywhere, but if its not in the DEFAULT locations, then they
are doing something special, and *they* have to do something special to
compensate, like use -I or -rubygems in RUBYOPTS.

Note that that is RUBY's require, not gem's require.

People aren't using gems for the most part because they want versioning,
they are using it because they want packaging, but they are being forced
to hack their environment as if they had done a custom install into a
non-standard location, when all they wanted was a simple tool to
download and install a library.

Why?

[snip] description, yet again, of how gem's require is better than
ruby's because it implements versioning... and all you have to do is
hack your environment, change the way you call ruby scripts, or change
(just a little bit) of code in all your scripts

* Versioning must be optional.

* Installed packages must be available with RUBY's require.

* A package manager that doesn't install things by default where RUBY
  can find them isn't a ruby package manager, its something else.

People who want to install packages in non-standard locations and use a
version selection system can, and if ruby gems gives a standard
framework to do that, great, but it needs to be optional.

Sam

···

On 3/3/05 11:53 PM, "Sam Roberts" <sroberts@uniserve.com> wrote:

* Richard Kilmer <rich@infoether.com> [2005-03-04 14:11:16 +0900]:

gem install net-mdns --deploy

Rich

I know this is a rather new idea, but would a deploy feature
have the option of installing with or without a version?
Seems like a nice thing, but maybe too complicated.

···

--
Jim Freeze
Code Red. Code Ruby

Quoting rich@infoether.com, on Fri, Mar 04, 2005 at 02:11:16PM +0900:

> Would be a work-around, and I'm afraid it is oriented at the installer
> of gems, so speaking as a library packager, it doesn't solve my
> problems.
>
> The command line tools I make that use my libraries, they do a
> "require", only. If "deployment" doesn't occur, and its an optional
> second step, the gem users who don't do the
>
> gem deploy net-mdns
>
> are going to be coming back to me and asking why my mdns.rb script won't
> find net/mdns. IMHO, if deploy doesn't always occur, it still leaves me
> with having to maintain different versions of scripts and libraries -
> gem using, and non-gem using.

No...they need to get your library:

gem install net-mdns

And if they have RUBYOPT=rubygems

They don't, so the script won't work.

Their code looks like:

MY CODE. IT'S MY CODE. Argh.

I wrote the script, I put it in the package, and I have to make two
versions of it, one assuming that my package was installed with ruby
gems in default mode, the other assuming ruby gems wasn't used or that
the user did "gem deploy".

gems has created two distinct dialects of ruby, one uses ruby's require,
and the other uses the gems require, of the same name. Code written in
ruby's dialect won't work with gems without hacking the code, or hacking
the environment.

Code written with the require_gems won't work for people who don't have
gems, even if they have the libraries.

Its a language split. It's a problem.

Having to set 'magic' environment variables or hack the code or command
line is a problem, not a fix.

require 'net/mdns'

If they don't have the RUBYOPT, or don't want it, they can do:

[snip] complex work arounds for a problem that should not have been
caused

The thing is you assume they install your net-mdns in site_ruby which may
not be what folks want. You need to have two steps...get the

NO. I don't assume they install in site_ruby, I assume they install
somewhere where ***ruby's require can find it***.

That can be anywhere, but if its not in the DEFAULT locations, then they
are doing something special, and *they* have to do something special to
compensate, like use -I or -rubygems in RUBYOPTS.

Note that that is RUBY's require, not gem's require.

People aren't using gems for the most part because they want versioning,
they are using it because they want packaging, but they are being forced
to hack their environment as if they had done a custom install into a
non-standard location, when all they wanted was a simple tool to
download and install a library.

Why?

[snip] description, yet again, of how gem's require is better than
ruby's because it implements versioning... and all you have to do is
hack your environment, change the way you call ruby scripts, or change
(just a little bit) of code in all your scripts

* Versioning must be optional.

* Installed packages must be available with RUBY's require.

* A package manager that doesn't install things by default where RUBY
  can find them isn't a ruby package manager, its something else.

People who want to install packages in non-standard locations and use a
version selection system can, and if ruby gems gives a standard
framework to do that, great, but it needs to be optional.

Somewhat heated this discussion of yours.

I'm certainly in favour of the --deploy scheme; the whole changing of the
require subsystem is what's kept me off gems so far. It just conjures images
from "Invasion of the body snatchers," for some reason (the remake, if you must
know).

The rest of the gem stuff being absolutely brilliant, this has stuck out like
a mammoth in a peapod; I never understood why it wasn't the default behaviour
to just collect all the packages to some directory and then include that in
the search path.

Sam

E

···

On Fri, March 4, 2005 5:37 am, Sam Roberts said:

On 3/3/05 11:53 PM, "Sam Roberts" <sroberts@uniserve.com> wrote:

* Sam Roberts <sroberts@uniserve.com> [2005-03-04 14:37:28 +0900]:

MY CODE. IT'S MY CODE. Argh.

I wrote the script, I put it in the package, and I have to make two
versions of it, one assuming that my package was installed with ruby
gems in default mode, the other assuming ruby gems wasn't used or that
the user did "gem deploy".

If I understand correctly, you shouldn't have to make
to versions of a script that is in a library.
The person writing code calling your lib needs
to be careful (see below), but your library
(ie code in your package) shouldn't have to
be conscious that it is a gem or not.

gems has created two distinct dialects of ruby, one uses ruby's require,
and the other uses the gems require, of the same name. Code written in
ruby's dialect won't work with gems without hacking the code, or hacking
the environment.

Code written with the require_gems won't work for people who don't have
gems, even if they have the libraries.

Is it really that much trouble to write:

  begin
    require 'some-lib'
  rescue LoadError
    require 'rubygems'
    require 'some-lib'
  end

Maybe we could get this added to the std distro, assuming
the gems ships with the std distro.

···

--
Jim Freeze
Code Red. Code Ruby

Sam: if it is an application script, then you have the ability to
solve it, too. Easily.

Look at bin/ruwiki_servlet in the Ruwiki package. I have a *single*
script that solves the problem of running in any of the
configurations that I have anticipated for Ruwiki.

If it's *not* an application script, then, well, they *know* it's a
gem, so they can do "require 'rubygems'" before requiring net/mdns.

-austin

···

On Fri, 4 Mar 2005 14:37:28 +0900, Sam Roberts <sroberts@uniserve.com> wrote:

MY CODE. IT'S MY CODE. Argh.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

i've solved the problem by not doing anything related to gems. i'd
have to create three different versions. the two you described, and
plain old ruby code.

gems left a bad taste for me when i started getting 'ubygem' errors,
and i was pretty sure i wasn't using anything related to gems...

having said all that. i think a standard way of installing ruby
modules/programs is a good idea...
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org

···

On Fri, 4 Mar 2005 14:37:28 +0900, you wrote:

I wrote the script, I put it in the package, and I have to make two
versions

Its a language split. It's a problem.

for some reason this aggravates the
hell out of me. yeah it is. i can
equate the above question with:

Is it really that much trouble to write:

#include <stdlib.h>
/* sorry, ruby sucks these days, so i've written this in c, hope you don't mind */
blah blah blah blah

there's a pretty dang good reason
that i use ruby. scripts are short
and pretty. if i wanted to write gob
loads of stub code i'd use java.

this bullshit that gem's introduces
makes my scripts look like hell and
i for one refuse to add it.

</rant>

Alex

···

On Mar 4, 2005, at 6:57 AM, Jim Freeze wrote:

Is it really that much trouble to write:

  begin
    require 'some-lib'
  rescue LoadError
    require 'rubygems'
    require 'some-lib'
  end

Guys,

Imagine going to the perl community and saying:

  We have this great new feature to add to the installation tool,
  versioning!

  You'll love it, and after you start using it, every single one of your
  perl scripts will stop working...

  But its easy, all you have to do is make some simple changes to every
  single one of the scripts you've deployed (many of which you didn't
  write) or else just make sure that you have this environment variable
  set everywhere you use perl.

  What? You don't like it? All you are perl gods, and you think its too
  hard to set a little environment variable everywhere you run perl, or
  just add a few little lines to every script?

You would be mocked, or just hear an astounded silence, really.

The environment is for *customization*, requiring env to be set in order
to run ruby is silly. Sorry if I sound a little heated, but I can't
understand why its even being thought of as an option!

Your programs should not have to be modified depending on the tool used
to install.

Its a non-starter. Better to hear this first from somebody who
really likes ruby, and really wants gems to work.

If you install something, and require doesn't load it, then ITS NOT
PROPERLY INSTALLED.

Quoting jim@freeze.org, on Fri, Mar 04, 2005 at 02:57:11PM +0900:

* Sam Roberts <sroberts@uniserve.com> [2005-03-04 14:37:28 +0900]:
> Code written with the require_gems won't work for people who don't have
> gems, even if they have the libraries.

Is it really that much trouble to write:

  begin
    require 'some-lib'
  rescue LoadError
    require 'rubygems'
    require 'some-lib'
  end

Multiply that code by 6 if I bring in 6 libs, any of which could have
been installed by the user with or without gems. Do you still think its
not that much trouble?

Of course, at this point you'd start every file with:

unless defined? special_require
  def special_require(p)
    begin
      require p
    rescue LoadError
      require 'rubygems'
      require p
    end
  end
end

special_require 'some-lib'

...

Imagine publishing this demo code in a DDJ issue, and imagine the first
letter to the editor:

  Why can't you just use 'require' in ruby? You can call 'import' in
  java/python, 'include' in C/C++, ....

Quoting halostatue@gmail.com, on Fri, Mar 04, 2005 at 03:44:06PM +0900:

> MY CODE. IT'S MY CODE. Argh.

Sam: if it is an application script, then you have the ability to
solve it, too. Easily.

I'm recently using OS X at home, mac-heads don't even know what the
environment IS, much less how to change it. They can't even see a
.bashrc file in their gui in order to open and edit it with the apple
text editor. And how am I supposed to convince Xcode to have RUBYOPT set
in its environment when it runs a ruby project?

You deploy things on customer sites, right? When those customers
reinstall ruby using the new great ruby gems installer, and all the
scripts you wrote last year fail, are you looking forward to "easily"
fixing all those scripts and redeploying them, instead of adding
a cool feature to PDFWriter?

Look at bin/ruwiki_servlet in the Ruwiki package. I have a *single*
script that solves the problem of running in any of the
configurations that I have anticipated for Ruwiki.

If it's *not* an application script, then, well, they *know* it's a
gem, so they can do "require 'rubygems'" before requiring net/mdns.

Sure, and then publish their script. Next guy who runs it, it dies.

Why? Oh, they don't have net/mdns installed as a gems.

No problem, we'll just patch up the script a little, it'll eventually
work...

Imagine if debian put the includes for any library you installed in a
special directory you had to add to your makefile and said "guys, it's
easy! just add this -I to your CFLAGS, and if you use automake its even
easier, just add this one line to all your autoconf setups... its easy!
And we've got versioning and nobody else does! We're great!'

What would you think? Why is it different with ruby?

Sam

···

On Fri, 4 Mar 2005 14:37:28 +0900, Sam Roberts > <sroberts@uniserve.com> wrote:

Agreed. To me,

require 'x'

reads easily. Rather than being a hack to get the code started by pulling in
other stuff, it TELLS me something -- what other facilities are being used --
and it's an important part of the code. Turning that simple statement into
logic about the ins-and-outs of what is available due to different underlying
implementations really obfuscates what is actually being said. Less
readable, more prone to errors, etc.

But then, I'm a newbie :slight_smile:

···

On Friday 04 March 2005 09:01, Alexander Kellett wrote:

On Mar 4, 2005, at 6:57 AM, Jim Freeze wrote:
> Is it really that much trouble to write:
>
> begin
> require 'some-lib'
> rescue LoadError
> require 'rubygems'
> require 'some-lib'
> end

this bullshit that gem's introduces
makes my scripts look like hell and
i for one refuse to add it.

--
Lee.

Guys,

Imagine going to the perl community and saying:

We have this great new feature to add to the installation tool,
versioning!

Sam, hit pause.

* Ruby did not have a standard installation and packaging tool
  prior to RubyGems.

Period.

Therefore, your analogy here is completely off base.

I *agree* with you regarding the use of RUBYOPT. I'm personally
quite annoyed that the Windows installer sets RUBYOPT at all, even
if it is a selectable option now (at my insistence). I've said as
much in a lot of places, including recently.

I disagree with you regarding the alternative require mechanism, but
also have pointed out that ultimately this stuff is planned to go
away. The sooner, the better.

RubyGem versioning is a good thing and is a way of solving the major
problems of CPAN. There are layers that can be placed on top of the
RubyGem versioning, and there are other things that can be done to
simplify things (e.g., if RubyGems went transactional, took
ownership of files, then it could install in site_ruby without any
problems, just like RPA).

[...]

Quoting jim@freeze.org , on Fri, Mar 04, 2005 at 02:57:11PM +0900:

* Sam Roberts <sroberts@uniserve.com > [2005-03-04 14:37:28
+0900]:

Code written with the require_gems won't work for people who
don't have gems, even if they have the libraries.

Is it really that much trouble to write:

begin
  require 'some-lib'
rescue LoadError
  require 'rubygems'
  require 'some-lib'
end

Multiply that code by 6 if I bring in 6 libs, any of which could
have been installed by the user with or without gems. Do you still
think its not that much trouble?

Nope. Once RubyGems is loaded once, then it isn't a big deal. In
Ruwiki (a very complex load situation with a complex layout), I did
the following:

  1) Try to load Ruwiki from the local directory structure (e.g.,
     ./lib/ and ../lib/).
  2) Try to load Ruwiki from the directory structure of the running
     script (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
  3) Try to load Ruwiki from the directory structure of the current
     file (e.g., File.dirname(__FILE__)/lib and
     File.dirname(__FILE__)/../lib).
  4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g.,
     site_ruby.
  5) Try to load Ruwiki from Rubygems.
  6) Fail hard.

This is *far* more complex than most scripts will ever need, and it
depends on the fact that Ruwiki is delivered as:

  bin/ruwiki_servlet
  lib/ruwiki/...
  ruwiki.cgi

So most often with the tar distribution, you'll run ruwiki_servlet
with:

  ruby bin/ruwiki_servlet

Because the tar distribution is intended to be deployed directly in
a public HTML environment, it can be run with the ruwiki.cgi in the
current directory.

But it's possible for other configurations, too. The cases required
for most applications with a recommended layout of executables in
bin/ and the library in lib/ are:

  1) Try to load <library> from the local directory structure (e.g.,
     ../lib).
  2) Try to load <library> from an unmodified $LOAD_PATH, e.g.,
     site_ruby.
  3) Try to load Ruwiki from Rubygems.
  4) Fail hard.

The code to do this would be:

  load_state = 1

  $LOAD_PATH.unshift "#{Dir.pwd}/../lib"

  begin
    require 'library'
  rescue LoadError
    $LOAD_PATH.shift if load_state == 1
    load_state += 1

    require 'rubygems' if load_state == 3
    raise if load_state == 4
    retry
  end

This is still for a complex situation, though. It could be as simple
as:

  begin
    require 'rubygems'
  rescue LoadError
    nil
  end

  require 'lib1'
  require 'lib2'
  require 'lib3'

That way, you get the gem version if it's installed, and people
don't complain.

Again, this is for application distribution, and I hope that it goes
away with the integration of RubyGems in Ruby. The sooner the
RubyGems team can hit 1.0, though, the more likely it will be that
Matz accepts it into the core and we can even get rid of (some of)
these hacks.

More than most people, I *know* this problem because of my
insistence that Ruwiki will be distributed as a .tar.gz, a RubyGem,
and an RPA package and all three are first-class citizens in the
eyes of Ruwiki. Just don't mix the packaging systems right now (it's
ugly).

[...]

You deploy things on customer sites, right? When those customers
reinstall ruby using the new great ruby gems installer, and all
the scripts you wrote last year fail, are you looking forward to
"easily" fixing all those scripts and redeploying them, instead of
adding a cool feature to PDFWriter?

I've written my applications defensively and extensively documented
my libraries. I go to extra effort to make sure that normal
installs, Gem installs, and RPA installs all Just Work.

If it's *not* an application script, then, well, they *know* it's
a gem, so they can do "require 'rubygems'" before requiring
net/mdns.

Sure, and then publish their script. Next guy who runs it, it
dies.

That's not *your* problem as the net/mdns publisher. Sorry, but it's
not. Don't try to own problems that aren't yours, ultimately.

The RPA-process would hopefully catch some of these things, and the
chances are that personA who published netdms-consumer would
probably publish it as ... a gem.

Ultimately, I agree with you. Ruby needs RubyGems in the core as a
replacement to require without doing 'require "rubygems"'. But it
does solve a very real problem, and it solves it reasonably well.

-austin

···

On Fri, 4 Mar 2005 23:37:50 +0900, Sam Roberts <sroberts@uniserve.com> wrote:
--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Well put. I think a lot of the fire would fade out of this debate if
RubyGems were integrated into Ruby in such a way that it didn't
require anything "special" to work. That has always been our hope and
intent.

···

On Sat, 5 Mar 2005 00:43:45 +0900, Austin Ziegler <halostatue@gmail.com> wrote:

Ultimately, I agree with you. Ruby needs RubyGems in the core as a
replacement to require without doing 'require "rubygems"'. But it
does solve a very real problem, and it solves it reasonably well.

--

Chad Fowler
http://chadfowler.com

http://rubygems.rubyforge.org (over 100,000 gems served!)

Chad Fowler wrote:

···

On Sat, 5 Mar 2005 00:43:45 +0900, Austin Ziegler <halostatue@gmail.com> wrote:

Ultimately, I agree with you. Ruby needs RubyGems in the core as a
replacement to require without doing 'require "rubygems"'. But it
does solve a very real problem, and it solves it reasonably well.

Well put. I think a lot of the fire would fade out of this debate if RubyGems were integrated into Ruby in such a way that it didn't
require anything "special" to work. That has always been our hope and
intent.

Chad, why does Gems need to override #require (or provide #require_gem)?
I haven't been able to find a concise explanation and I'd rather not
poke around source code.

E