Multiple Versions of Ruby on same machine

Discussion in 'Ruby' started by S. Robert James, Jan 1, 2007.

  1. I'd like to include a complete version of Ruby, including all the
    necessary libs, in the source tree for our internal app. That will
    allow our unit tests/QA procedure/app deployment scripts to take
    responsibility for upgrades to Ruby as well.

    To do this, I of course need to include /usr/lib/ruby/* and
    /usr/bin/ruby. And to set the PATH to use our local Ruby.

    But it seems that I need to do more:
    $ irb
    irb(main):001:0> $:
    => ["/usr/lib/ruby/site_ruby/1.8",
    "/usr/lib/ruby/site_ruby/1.8/i386-linux", "/usr/lib/ruby/site_ruby",
    "/usr/lib/site_ruby/1.8", "/usr/lib/site_ruby/1.8/i386-linux",
    "/usr/lib/site_ruby", "/usr/lib/ruby/1.8",
    "/usr/lib/ruby/1.8/i386-linux", "."]

    Where are those paths located? strings ruby didn't turn them up. I
    need to be able to tell it to use the app's private ruby installation.

    In general, has anyone done anything like this? What was their
    experience? How would you recommend going about doing this?
     
    S. Robert James, Jan 1, 2007
    #1
    1. Advertising

  2. Robert James wrote:
    > I'd like to include a complete version of Ruby, including all the
    > necessary libs, in the source tree for our internal app. That will
    > allow our unit tests/QA procedure/app deployment scripts to take
    > responsibility for upgrades to Ruby as well.
    >
    > To do this, I of course need to include /usr/lib/ruby/* and
    > /usr/bin/ruby. And to set the PATH to use our local Ruby.
    >
    > But it seems that I need to do more:
    > $ irb
    > irb(main):001:0> $:
    > => ["/usr/lib/ruby/site_ruby/1.8",
    > "/usr/lib/ruby/site_ruby/1.8/i386-linux", "/usr/lib/ruby/site_ruby",
    > "/usr/lib/site_ruby/1.8", "/usr/lib/site_ruby/1.8/i386-linux",
    > "/usr/lib/site_ruby", "/usr/lib/ruby/1.8",
    > "/usr/lib/ruby/1.8/i386-linux", "."]
    >
    > Where are those paths located? strings ruby didn't turn them up. I
    > need to be able to tell it to use the app's private ruby installation.
    >
    > In general, has anyone done anything like this? What was their
    > experience? How would you recommend going about doing this?


    It's compiled in at build time, I think. Check out ruby config.

    I think I'd try building it from source and installing in a custom
    directory for example /opt/myruby. Then when you install it on the
    target machines you put it in the same place.

    --
    Posted via http://www.ruby-forum.com/.
     
    Michael Greenly, Jan 1, 2007
    #2
    1. Advertising

  3. On 1/1/07, S. Robert James <> wrote:
    > I'd like to include a complete version of Ruby, including all the
    > necessary libs, in the source tree for our internal app.


    I'm not sure if this is applicable in your particular situation, but you can
    change $: at runtime using the "shift" and "unshift" methods. You
    could modify your Ruby scripts to change $: as the first thing they do,
    so all the paths point to your local version of Ruby.

    Wayne

    ---
    Wayne Vucenic
    No Bugs Software
    Ruby, C# and Erlang Agile Contract Programming in Silicon Valley
     
    Wayne Vucenic, Jan 1, 2007
    #3
  4. S. Robert James wrote:
    > Where are those paths located? strings ruby didn't turn them up. I
    > need to be able to tell it to use the app's private ruby installation.
    >
    > In general, has anyone done anything like this? What was their
    > experience? How would you recommend going about doing this?


    You can install Ruby anywhere by getting the source code and running
    something like:

    /configure --prefix=/your/favorite/directory
    make
    make install

    Then, you should make sure that the right version is used when running
    your project. Make sure that:

    * this install of ruby is in the $PATH
    * your scripts include the full path to your ruby executable in the
    #!... line

    Is that what you were looking for ?

    Vince

    --
    Vincent Fourmond, PhD student
    http://vincent.fourmond.neuf.fr/
     
    Vincent Fourmond, Jan 1, 2007
    #4
  5. On 1/1/07, S. Robert James <> wrote:

    > In general, has anyone done anything like this? What was their
    > experience? How would you recommend going about doing this?


    I don't really have any experience with this, but I think multiruby in
    ZenTest does this, and you might be able to use it as a reference.
     
    Gregory Brown, Jan 1, 2007
    #5
  6. S. Robert James

    matt Guest

    Is there a similar method to use a different Ruby version with Rails?


    On Tue, 2007-01-02 at 08:17 +0900, Vincent Fourmond wrote:
    > S. Robert James wrote:
    > > Where are those paths located? strings ruby didn't turn them up. I
    > > need to be able to tell it to use the app's private ruby installation.
    > >
    > > In general, has anyone done anything like this? What was their
    > > experience? How would you recommend going about doing this?

    >
    > You can install Ruby anywhere by getting the source code and running
    > something like:
    >
    > ./configure --prefix=/your/favorite/directory
    > make
    > make install
    >
    > Then, you should make sure that the right version is used when running
    > your project. Make sure that:
    >
    > * this install of ruby is in the $PATH
    > * your scripts include the full path to your ruby executable in the
    > #!... line
    >
    > Is that what you were looking for ?
    >
    > Vince
    >
     
    matt, Jan 2, 2007
    #6
  7. matt <> wrote:

    > Is there a similar method to use a different Ruby version with Rails?


    i don't know how but i'm sure it is because i've only Rails under jRuby
    which has it's own ruby install.
    --
    Artaban de Médée
     
    Artaban de Médée, Jan 2, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. UJ
    Replies:
    2
    Views:
    449
  2. Replies:
    2
    Views:
    3,883
    Fuzzyman
    Feb 24, 2006
  3. Cowmix
    Replies:
    3
    Views:
    469
  4. della
    Replies:
    6
    Views:
    346
    Peter Otten
    Nov 28, 2008
  5. Yves Petinot
    Replies:
    9
    Views:
    333
    Brian McCauley
    Jun 30, 2004
Loading...

Share This Page