Forum: Ruby 1.8 and 1.9 on arch linux

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Martin DeMello (Guest)
on 2009-04-20 06:39
(Received via mailing list)
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 (Guest)
on 2009-04-20 06:41
(Received via mailing list)
yes - me!

saji

* Martin DeMello <removed_email_address@domain.invalid> [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                        removed_email_address@domain.invalid
Fax: +82-51-745-3999
Saji N. Hameed (Guest)
on 2009-04-20 06:48
(Received via mailing list)
> 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... :)

saji
> > martin
>
>
>
>
>

--
Saji N. Hameed

APEC Climate Center
1463 U-dong, Haeundae-gu,                               +82 51 745 3951
BUSAN 612-020, KOREA                        removed_email_address@domain.invalid
Fax: +82-51-745-3999
Martin DeMello (Guest)
on 2009-04-20 07:03
(Received via mailing list)
On Mon, Apr 20, 2009 at 8:17 AM, Saji N. Hameed 
<removed_email_address@domain.invalid> 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... :)

I have that much working already :) 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
Alex Eiras (Guest)
on 2009-04-20 12:23
(Received via mailing list)
> installation.
>
> martin
>

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
Pablo Digonzelli (Guest)
on 2009-04-20 19:51
(Received via mailing list)
Saji N. Hameed
escribió:>
>>> ideally without subverting the package manager too much.
>> BUSAN 612-020, KOREA                        removed_email_address@domain.invalid
>> Fax: +82-51-745-3999
>>
>>
>>
>>
>>
>>
>
>


--
Pablo R. Digonzelli
Socio Gerente
Software Solutions
IP Soluciones
25 de Mayo 521
San Miguel de Tucuman
0381 4304441
Igor P. (Guest)
on 2009-04-20 21:34
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
Igor P. (Guest)
on 2009-04-20 22:06
#!/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.
Daniel DeLorme (Guest)
on 2009-04-21 02:52
(Received via mailing list)
Martin DeMello wrote:
> I have that much working already :) 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
This topic is locked and can not be replied to.