What happens when Rails 1.3.5 is installed on top of 2.3.5?

On a Mac running Snow Leopard, the Rails version was 2.3.5 (by using
rails -v)

and then I used gem install to install about 20 things, and maybe there
was a line on the instructions that was there in the past that says

gem install rails -v=1.3.5

and I ran it anyways, thinking that maybe 1.3.5 is a different version
number…

and it installed 5 gems (as i remember).

Will that actually affect the current rails?

Even after the installation, when I use

rails -v

it still says 2.3.5

and also if it is

gem list rails

it would list something like

rails (2.3.5, 2.3.2, 1.3.5)

so looks like they exist nicely with each other without affecting one
another? thanks.

On May 21, 10:44 am, Jian L. [email protected] wrote:

and also if it is

gem list rails

it would list something like

rails (2.3.5, 2.3.2, 1.3.5)

so looks like they exist nicely with each other without affecting one
another? thanks.

Yup, rubygems is designed to handle that sort of thing. Installed
executables (eg the rails executable that sets up a new app) will run
the latest version), you can run older versions by doing (for example)
rails 1.3.5 anoldapp
The fiddly stuff is when the old version of rails doesn’t cope with
the version of ruby you have, eg rails didn’t handle ruby 1.8.7 before
2.1 (I think, could be a different version but you get the idea) or
uses functionality that was deprecated and later removed in newer
versions of rubygems.

Fred

Just in case it applies here is an extract from the Pickaxe book
(Second edition, page 217):

“Threre’s a subtlety when it comes to installing different versions of
the same application with RubyGems. Even though RubyGems keeps
separate versions of the application’s library files, it does not
version the actual command you use to run the application. As a
result, each install of an application effectively overwrites the
previous one.”

pepe wrote:

Just in case it applies here is an extract from the Pickaxe book
(Second edition, page 217):

“Threre’s a subtlety when it comes to installing different versions of
the same application with RubyGems. Even though RubyGems keeps
separate versions of the application’s library files, it does not
version the actual command you use to run the application. As a
result, each install of an application effectively overwrites the
previous one.”

so that means it will be safest if i re-run

gem install rails

or

gem install rails -v2.3.5

again?

I would, just in case, not being sure of the repercussions that
installing a prior version of the gem would have.

On Sat, May 22, 2010 at 2:47 PM, pepe [email protected] wrote:

Just in case it applies here is an extract from the Pickaxe book
(Second edition, page 217):

“Threre’s a subtlety when it comes to installing different versions of
the same application with RubyGems. Even though RubyGems keeps
separate versions of the application’s library files, it does not
version the actual command you use to run the application. As a
result, each install of an application effectively overwrites the
previous one.”

That’s actually not the whole story, and excerpt from the output of
gem help install:

Description:
The install command installs local or remote gem into a gem
repository.

For gems with executables ruby installs a wrapper file into the 

executable
directory by default. This can be overridden with the --no-wrappers
option.
The wrapper allows you to choose among alternate gem versions using
version.

For example `rake _0.7.3_ --version` will run rake version 0.7.3 if 

a newer
version is also installed.

The “actual command you use to run the application” is actually a bit
of boilerplate generated by gems which requires the gem and then calls
the executable in the bin directory of the gem. If you use that
{version} option it requires a specific version of the gem.

So if you have both rails 2.3.5 and 1.2.6 installed then either

rails
or
rails 2.3.5

will run version 2.3.5 which is the latest version installed. but

rails 1.2.6

will run version 1.2.6

HTH

BTW, the OP gave rails version 1.3.5 as a example, as far as I know
this a fictitious version since rails went from version 1.2.6 to
version 2.0.0


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Rick Denatale wrote:

That’s actually not the whole story, and excerpt from the output of
gem help install:

Description:
The install command installs local or remote gem into a gem
repository.

For gems with executables ruby installs a wrapper file into the 

executable
directory by default. This can be overridden with the --no-wrappers
option.
The wrapper allows you to choose among alternate gem versions using
version.

For example `rake _0.7.3_ --version` will run rake version 0.7.3 if 

a newer
version is also installed.

What about if Rails 2.3.5 is installed and then 1.2.5 is installed? It
seems like after that

rails -v

will still give 2.3.5. So the default executable is not overwritten or
linked to 1.2.5 but to the newest version.

Also, if we run

rails 1.2.5

the won’t all the supporting files, script, etc, etc also need to be
versioned? So probably that is automatically taken care of as well?

So, supposedly, we can install rails in ANY ORDER – 2.3.5 first, and
then 2.2.2 and then 1.2.5 and they still all work well, and the default
one is still the 2.3.5 version?

wow, if only Windows application can do that too…