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

Discussion in 'Ruby' started by Erik Veenstra, Mar 28, 2005.

  1. 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.
     
    Erik Veenstra, Mar 28, 2005
    #1
    1. Advertisements

  2. IMO, the best thing is
    Why? I bet you foresee something I missed.

    gegroet,
    Erik V.
     
    Erik Veenstra, Mar 28, 2005
    #2
    1. Advertisements

  3. You don't need to have gems installed; you can simply install
    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"

    ----------------------------------------------------------------
     
    Erik Veenstra, Mar 28, 2005
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.