RUBYOPT="rubygems" doesn't feel good...

E

Erik Veenstra

When you set RUBYOPT to "rubygems", library ubygems is
automatically required before starting the application. You
don't have to do a require of (r)ubygems in the application
itself anymore. If the application doesn't require rubygems
internally, it can only run in an environment in which RUBYOPT
is set to "rubygems".

What happens when such an application is shipped to a machine
which does have rubygems and the right gems, (so it should be
able to run perfectly), but doesn't have RUBYOPT set to require
rubygems? The only solution to get such an application to work
(out of the box) is to set RUBYOPT as well, which does affect
the other applications...

It just doesn't feel good...

gegroet,
Erik V.
 
E

Erik Veenstra

You don't need to have gems installed; you can simply install
the libraries (assuming they have the same name as the gems).
And, you don't need to have RUBYOPTS set.

Oh, I see what you mean... But it's not what I'm talking about.
That's why I was a bit confused.

I, the customer have installed RubyGems, as well as the gems on
which the application depends, but I didn't set RUBYOPT. When
you, the developer, give me an application which doesn't
require rubygems internally, it's not going to run on my
machine. Is it? You could easily avoid that by doing a "require
'rubygems'" internally. There's no need to rescue it.

You're talking about whether I, the customer, need to install
RubyGems at all. You could avoid that "have to" by rescuing the
"require 'rubygems'". Well, in theory, but no in practice. See
the examples.

"In theory there is no difference between theory and practice.
In practice there is."...

gegroet,
Erik V.

----------------------------------------------------------------

# Example 1

require "rubygems"
require "sqlite"

----------------------------------------------------------------

# Example 2

$: << "/usr/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/lib/"
require "sqlite"

----------------------------------------------------------------
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top