What version of Rail, Ruby & my website is using?

Hi guys,

I am working on importing a website locally to do some changes in a safe
mode.

Is there a way to go to the website itself and check what is the
package ( rails version ,..etc) in order to avoid any conflict?

i need simply to reproduce the same environment as in the production to
be able to do my changes locally

Any suggestion will be appreciated?

thanks

If it's a Rails 2.x.x app, there's probably going to be a line near the top
of config/environment.rb like:
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION

You can also use the commands `rails -v`, `ruby -v`, `gem list`, and
`gem env` to explore the original environment.

Having recently gone through this with an app I didn't write, I'd suggest
(assuming it's not under any source control)

1) tar up the whole thing and untar it on your system
2) create a git repo and commit the app as-is
3) try to run the tests and/or run the app locally; if anything's missing
     on your system that the app needs, you'll know quickly enough. :slight_smile:
4) this may be a good point to set up a separate gemset, if you're using
     rvm locally.

    If the original system and your system are different architectures,
    you might have to un-vendor gems with native code.

Good luck!

Hi guys,

I am working on importing a website locally to do some changes in a safe
mode.

Is there a way to go to the website itself and check what is the
package ( rails version ,..etc) in order to avoid any conflict?

Assuming you have access to the source (you will have difficulty
'importing' it otherwise, though import is a strange word to use) then
look in config/environment.rb and you will likely see a line like
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
in which case it is 2.3.8. But also check in folder vendor. If there
is a Rails folder in there then that will be used whatever version it
is.

The above assumes it is not Rails 3, if it is then look in Gemfile in
the application root folder.

Colin

Colin Law wrote in post #982958:

korssane korssane wrote in post #982985:

Colin Law wrote in post #982958:

Hi guys,

I am working on importing a website locally to do some changes in a safe
mode.

Is there a way to go to the website itself and check what is the
package ( rails version ,..etc) in order to avoid any conflict?

Assuming you have access to the source (you will have difficulty
'importing' it otherwise, though import is a strange word to use) then
look in config/environment.rb and you will likely see a line like
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
in which case it is 2.3.8. But also check in folder vendor. If there
is a Rails folder in there then that will be used whatever version it
is.

The above assumes it is not Rails 3, if it is then look in Gemfile in
the application root folder.

Colin

thanks guys,
i will try your suggestions and get back to you.

thanks again

Hey guys,
i figure out that the website is running using the following :
rails : 2.1.0
ruby 1.8.6

what i have to do in this case..

Update to rails 3 and try to run the website locally ?
or repicate the same environment locally ?

i am quite confused and i am really a new beginner.

Any suggestion will be more thsan appreciated.

thanks

I would strongly suggest you follow my earlier suggestions to get the
app running *just as it is* locally first.

Then start upgrading to Ruby 1.8.7 and the most recent Rails 2.3.x
version, a step at a time.

This will be less problematic if your app has good tests. If it doesn't,
you'd be better off writing them first.

Good luck,

Hassan Schroeder wrote in post #983024:

Hassan is correct. After getting it to run locally as 2.1 you're going
to want to move the site from Rails 2.1 to 2.2.2 then to 2.3.8 and
then finally 3.* There are going to be a lot of deprecations along the
way that you will need to fix in order to make the process of moving
to the next version easier. The alternative is to get the thing
running locally as a 2.1 app and then in a different project re-write
the entire application in 3.*.

Good luck!

B.

1- how can i cleaup every thing and start from zero .
i have check the production environment and got the follwing :

Your best bet is to use either rvm or some virtualization technology
like VirtualBox or VMWare to create a "sandbox" that you can set up
*exactly* as the current production server is configured.

Same version of Ruby, RubyGems, Rails, and all the required gems.
If you do that, the app should run "as is". If it doesn't, figure out why.
Does the app have tests? If so, run them; if any of them fail, it'll tell
you a lot. If it doesn't have tests, write some.

In any case, get the tests to run and/or the app to run without any
apparent errors.

Then you can start upgrading things *one at a time*.

What you are trying to do is *not easy* for someone without much
Rails experience, but it *is* possible and you'll learn a lot.

But let me again emphasize:

use git. write tests. change one thing at a time. <<

Good luck!

thanks Hassane,

1 - iam already using Virtual box..lol

If your application is already locked to Rails 2.1 then you can run
any version of Rails above that on the server and it will use the code
locked into your application to run it as Rails 2.1. How do you know
if it is locked? Look under the vendor folder in your application. If
there is a rails folder it is locked to the version of rails code in
that folder.

B.

Bryan Crossland wrote in post #983161:

If your application is already locked to Rails 2.1 then you can run
any version of Rails above that on the server and it will use the code
locked into your application to run it as Rails 2.1. How do you know
if it is locked? Look under the vendor folder in your application. If
there is a rails folder it is locked to the version of rails code in
that folder.

B.

On Tue, Feb 22, 2011 at 11:45 AM, korssane korssane

Hi Bryan ,
Thanks for this new suggestion. Unfortunately i see only pluging floder
under Vendor one ...which means the application is not locked...

Ok. The last time I checked this application was locked to Rails 2.1.

https://github.com/insoshi/insoshi

Copy the rails folder from this application's vendor folder to your's
and that should lock yours to version 2.1. Let us know how it goes.

B.

Bryan Crossland wrote in post #983170:

Hassan is correct. After getting it to run locally as 2.1 you're going
to want to move the site from Rails 2.1 to 2.2.2 then to 2.3.8 and
then finally 3.* There are going to be a lot of deprecations along the
way that you will need to fix in order to make the process of moving
to the next version easier. The alternative is to get the thing
running locally as a 2.1 app and then in a different project re-write
the entire application in 3.*.

Good luck!

B.

On Mon, Feb 21, 2011 at 8:22 PM, Hassan Schroeder

thanks bryan
i will try my best.

hey guys ,
i am trying to run script/server but getting the following error :

So do you have that gem installed? If not, install it. If you do, what
version do you have, and what's on the server?