Ruby 1.8 and 1.9

C

Cliff Rowley

I've just successfully compiled Ruby 1.9 under Cygwin (which was
surprisingly easy). Is there a (simple) way to allow 1.8 and 1.9 to
co-exist, allowing me to switch between them at will?

Thanks

Cliff
 
J

John Joyce

I've just successfully compiled Ruby 1.9 under Cygwin (which was
surprisingly easy). Is there a (simple) way to allow 1.8 and 1.9 to
co-exist, allowing me to switch between them at will?

Thanks

Cliff
create an alias or symlink for at least one of them and have them in
different directories
If you create a symlink for 1.9 called ruby19 you can call the 1.9
interpreter with
ruby19 script_name.rb

Likewise you could create ruby18 for 1.8
That's the easiest way to do it, and common with other software such
as PHP 4 or 5 on the same system.
Usually, people leave one of the two installations as the default
with simply PHP
you can do this with Ruby too.

With Ruby Gems you might run into some trouble though.
 
C

Cliff Rowley

create an alias or symlink for at least one of them and have them in
different directories
If you create a symlink for 1.9 called ruby19 you can call the 1.9
interpreter with
ruby19 script_name.rb

Thanks, I figured the ruby interpreter itself might be as easy as that.
With Ruby Gems you might run into some trouble though.

Buut yes, this is where I thought I may come unstuck ;-)

Any thoughts?

Cliff
 
J

John Joyce

Buut yes, this is where I thought I may come unstuck ;-)

Any thoughts?

Cliff
Well, number 1, I've never actually used or installed 1.9 yet, no
hurry for me.
So I don't know if the load path is any different or things like the
gem path. I imagine that when you do the installation of rubygems,
you can alias it as well, so that you call gem19 or something and set
your gem_path to be for 1.9's gem directory (wherever that is,
probably similar to 1.8, but I don't know)
(If I were you I'd keep 1.8 stuff unaliased and normal for now)

Now here's the trick... when you install any command line software in
a custom manner, it becomes very tricky for things installed on top
of that. (3rd party software) Other stuff may make stupid (?)
assumptions about your installation.

So here I've thought of a better way to do this.
You're using CygWin so I'm assuming it's windows and I don't know
much about this on windows, but you might try creating another user
account in windows, and install everything for ruby 1.9 under that
instead. if it works, you can totally avoid all the fragile custom
installation stuff. Just a logout / login away.
 
C

Cliff Rowley

So here I've thought of a better way to do this.
You're using CygWin so I'm assuming it's windows and I don't know
much about this on windows, but you might try creating another user
account in windows, and install everything for ruby 1.9 under that
instead. if it works, you can totally avoid all the fragile custom
installation stuff. Just a logout / login away.

That wouldn't really work for a number of reasons. Firstly because
things like Ruby and Cygwin are installed globally, not on a per-user
basis - so I wouldn't actually gain anything by switching user
accounts. Secondly because my development environment exists under my
user account, so switching users would kinda cripple me ;-)

There must be a simple way to do this. I'll try fiddling with things
like the gem path. As you say, things make assumptions, and this is
what I'm afraid of - I don't want to hose my existing Ruby.

Cliff
 
J

John Joyce

That wouldn't really work for a number of reasons. Firstly because
things like Ruby and Cygwin are installed globally, not on a per-user
basis - so I wouldn't actually gain anything by switching user
accounts. Secondly because my development environment exists under my
user account, so switching users would kinda cripple me ;-)

There must be a simple way to do this. I'll try fiddling with things
like the gem path. As you say, things make assumptions, and this is
what I'm afraid of - I don't want to hose my existing Ruby.

Cliff
Hmm... on *nix, things like this are not necessarily global, but per
user.
You normally install things in /usr/local or a subdirectory of that,
pretty instantly allowing each user to have a custom setup from there
or from their shell login script. I know that Windows (not 95 or 98)
has some unix-like features here and there, but I don't know how much
in the users/accounts area.
Cygwin is a *nix-like environment so I thought it might be possible
from there...
Hate to say this, because I don't like to be an OS basher too much,
but maybe you should get an install of Linux to boot into, or go out
and buy a cheapo second hand pc or year old model or something just
for Linux/Unix installation?
You wouldn't need tons of HD or RAM or graphics ability, just an
internet capable machine.
This wouldn't help for testing 1.9 on windows though.
Maybe somebody else knows a solution..?
 
C

Cliff Rowley

Hmm... on *nix, things like this are not necessarily global, but per
user.
You normally install things in /usr/local or a subdirectory of that,
pretty instantly allowing each user to have a custom setup from there
or from their shell login script. I know that Windows (not 95 or 98)
has some unix-like features here and there, but I don't know how much
in the users/accounts area.

Yep, I'm a pretty experienced Linux/BSD user - but my options are
pretty much limited to Windows or Mac, since I use a hefty array of
Adobe products in my work too. I'm looking to buy myself a Mac in the
next few weeks, but for now I'm unfortunately stuck with Windows - and
Cygwin is as close to sanity as I can get here ;-)
Cygwin is a *nix-like environment so I thought it might be possible
from there...

It may be possible by setting the PREFIX variable on compilation, but
again as you say things make assumptions, so I still can't guarantee
the safety of my current Ruby installation.

I guess I'll keep playing until I find something that works for me, thanks :)
 
Y

Yuri Klubakov

I've just successfully compiled Ruby 1.9 under Cygwin (which was
surprisingly easy). Is there a (simple) way to allow 1.8 and 1.9 to
co-exist, allowing me to switch between them at will?

Thanks

Cliff

This is how I would switch between different ruby versions under Windows:
- Install Ruby 1.8 into the default c:\ruby directory.
- Rename c:\ruby to c:\ruby18
- Install Ruby 1.9 into the default c:\ruby directory.
- Rename c:\ruby to c:\ruby19
- Create a junction point to the version you want to use:
c:\> junction c:\ruby c:\ruby18
- To switch:
c:\> junction -d c:\ruby
c:\> junction c:\ruby c:\ruby19
 
K

Konrad Meyer

--nextPart1561080.i8yz91svbG
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I've just successfully compiled Ruby 1.9 under Cygwin (which was
surprisingly easy). Is there a (simple) way to allow 1.8 and 1.9 to
co-exist, allowing me to switch between them at will?
=20
Thanks
=20
Cliff

When you configure ruby 1.9, use the flag `--program-suffix=3D19' and all
binaries (ruby, irb, etc) will be suffixed with '19' (ruby19, irb19, etc).

=2D-=20
Konrad Meyer <[email protected]> http://konrad.sobertillnoon.com/

--nextPart1561080.i8yz91svbG
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG2oUtCHB0oCiR2cwRAvdoAKCCZJbkHwD4siUtNp4iVBS8+gHdbgCfabAw
fLvl8DmzzShhypKE7mO+PbM=
=IlDr
-----END PGP SIGNATURE-----

--nextPart1561080.i8yz91svbG--
 
C

Cliff Rowley

When you configure ruby 1.9, use the flag `--program-suffix=19' and all
binaries (ruby, irb, etc) will be suffixed with '19' (ruby19, irb19, etc).

Now that indeed, is what I'm talking about ;-)

I can't believe I missed that. Thanks!
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top