1.8 and 1.9 on arch linux

Anyone on arch linux? I'm trying to get ruby 1.8 and 1.9 playing
nicely together so that I can easily switch the default "ruby" and
have everything else (rake, irb, rdoc etc) adjust itself accordingly,
ideally without subverting the package manager too much.

martin

yes - me!

saji

* Martin DeMello <martindemello@gmail.com> [2009-04-20 11:39:05 +0900]:

···

Anyone on arch linux? I'm trying to get ruby 1.8 and 1.9 playing
nicely together so that I can easily switch the default "ruby" and
have everything else (rake, irb, rdoc etc) adjust itself accordingly,
ideally without subverting the package manager too much.

martin

--
Saji N. Hameed

APEC Climate Center
1463 U-dong, Haeundae-gu, +82 51 745 3951
BUSAN 612-020, KOREA saji@apcc21.net
Fax: +82-51-745-3999

yes - me!

sorry, my reply was incomplete... in my case, i just compiled 1.9 separately
in a separate directory without using the package manager, and aliased
the 1.9 version using ruby19 and irb19. In case of 1.9, gems get installed
under the 1.9 installation root without disturbing the main ruby installation.
So I guess rake, rdoc etc should work fine if you use either one (1.8 or 1.9)

i don't know if my answer helps much... :slight_smile:

saji

···

saji

* Martin DeMello <martindemello@gmail.com> [2009-04-20 11:39:05 +0900]:

> Anyone on arch linux? I'm trying to get ruby 1.8 and 1.9 playing
> nicely together so that I can easily switch the default "ruby" and
> have everything else (rake, irb, rdoc etc) adjust itself accordingly,
> ideally without subverting the package manager too much.
>
> martin
>
>

--
Saji N. Hameed

APEC Climate Center
1463 U-dong, Haeundae-gu, +82 51 745 3951
BUSAN 612-020, KOREA saji@apcc21.net
Fax: +82-51-745-3999

--
Saji N. Hameed

APEC Climate Center
1463 U-dong, Haeundae-gu, +82 51 745 3951
BUSAN 612-020, KOREA saji@apcc21.net
Fax: +82-51-745-3999

I have that much working already :slight_smile: What I want to do is have the
default ruby switch between 1.8 and 1.9 when I run a command - right
now I run 1.8 as 'ruby' and 1.9 as ruby-1.9. I hacked something up by
manually renaming ruby to ruby-1.8 and adding symlinks, but I was
hoping there was some sort of standard way to do it.

martin

···

On Mon, Apr 20, 2009 at 8:17 AM, Saji N. Hameed <saji@apcc21.net> wrote:

yes - me!

sorry, my reply was incomplete... in my case, i just compiled 1.9 separately
in a separate directory without using the package manager, and aliased
the 1.9 version using ruby19 and irb19. In case of 1.9, gems get installed
under the 1.9 installation root without disturbing the main ruby installation.
So I guess rake, rdoc etc should work fine if you use either one (1.8 or 1.9)

i don't know if my answer helps much... :slight_smile:

Implement something like the following:

#!/bin/bash

if [ $# -eq 0 ]; then
  version=9
else
  case $1 in
  -h|-H) echo "usage: $(basename $0) -8|-9 | [-h]"; exit;;
  8|-8) version=8;;
  9|-9) version=9;;
  *) echo Illegal argument; exit;;
  esac
fi

if [ $version = 9 ] ;then
  echo Currently your ruby version is 1.9
  rm /usr/bin/ruby
  ln -s /usr/bin/ruby1.9 /usr/bin/ruby
  rm /usr/bin/irb
  ln -s /usr/bin/irb1.9 /usr/bin/irb
else
  echo Currently your ruby version is 1.8
  rm /usr/bin/ruby
  ln -s /usr/bin/ruby1.8 /usr/bin/ruby
  rm /usr/bin/irb
  ln -s /usr/bin/irb1.8 /usr/bin/irb
fi

···

--
Posted via http://www.ruby-forum.com/.

If you are using a Debian based system, you may want to take a look at
update-alternatives: it maintains symbolic links determining default
commands (aka. Debian alternatives system)

Cheers
Alex

···

On Mon, Apr 20, 2009 at 8:17 AM, Saji N. Hameed <saji@apcc21.net> wrote:
>
>> yes - me!
>
> sorry, my reply was incomplete... in my case, i just compiled 1.9
separately
> in a separate directory without using the package manager, and aliased
> the 1.9 version using ruby19 and irb19. In case of 1.9, gems get
installed
> under the 1.9 installation root without disturbing the main ruby
installation.
> So I guess rake, rdoc etc should work fine if you use either one (1.8 or
1.9)
>
> i don't know if my answer helps much... :slight_smile:

I have that much working already :slight_smile: What I want to do is have the
default ruby switch between 1.8 and 1.9 when I run a command - right
now I run 1.8 as 'ruby' and 1.9 as ruby-1.9. I hacked something up by
manually renaming ruby to ruby-1.8 and adding symlinks, but I was
hoping there was some sort of standard way to do it.

martin

#!/bin/bash

if [ $# -eq 0 ]; then
  version=9
else
  case $1 in
  -h|-H) echo "usage: $(basename $0) -8|-9 | [-h]"; exit;;
  8|-8) version=8;;
  9|-9) version=9;;
  *) echo Illegal argument; exit;;
  esac
fi

if [ $version = 9 ] ;then
  echo Currently your ruby version is 1.9
  rm /usr/bin/ruby
  ln -s $(which ruby1.9) /usr/bin/ruby
  rm /usr/bin/irb
  ln -s $(which irb1.9) /usr/bin/irb
else
  echo Currently your ruby version is 1.8
  rm /usr/bin/ruby
  ln -s $(which ruby1.8) /usr/bin/ruby
  rm /usr/bin/irb
  ln -s $(which irb1.8) /usr/bin/irb
fi

If you installed all versions of your ruby in standard places or if your
path is pointing to them as it should, the above code is more
appropriate.

···

--
Posted via http://www.ruby-forum.com/.

Martin DeMello wrote:

···

On Mon, Apr 20, 2009 at 8:17 AM, Saji N. Hameed <saji@apcc21.net> wrote:

yes - me!

sorry, my reply was incomplete... in my case, i just compiled 1.9 separately
in a separate directory without using the package manager, and aliased
the 1.9 version using ruby19 and irb19. In case of 1.9, gems get installed
under the 1.9 installation root without disturbing the main ruby installation.
So I guess rake, rdoc etc should work fine if you use either one (1.8 or 1.9)

i don't know if my answer helps much... :slight_smile:

I have that much working already :slight_smile: What I want to do is have the
default ruby switch between 1.8 and 1.9 when I run a command - right
now I run 1.8 as 'ruby' and 1.9 as ruby-1.9. I hacked something up by
manually renaming ruby to ruby-1.8 and adding symlinks, but I was
hoping there was some sort of standard way to do it.

I'm not sure if it's going to help, but what I did was compile ruby1.8
and 1.9 in separate directories (/opt/ruby/1.8 and /opt/ruby/1.9) and
then prepend either /opt/ruby/1.8/bin or /opt/ruby/1.9/bin to the $PATH
depending on which version I want to use.

Daniel