dev server -- which Ruby?

I have a development server running Mac OS X Server 10.5, using Ruby 1.8.6. It's been quite a while since I set this up, but I think I built it with Dan Benjamin's recipe, so it might be a compiled from scratch Ruby, rather than the one that shipped with Server 10.5.

I have some sites in progress using Rails 2.3.8 and 2.3.5, but I would like to try Rails 3. Is there a version of Ruby I can install on the server which will straddle both of those rowboats without pitching me into the river? I don't want to upgrade the other sites, and I don't want to have a bad experience with Rails 3.

Any suggestions?

Walter

I would suggest using RVM: http://rvm.beginrescueend.com/ so that you can use 1.8.7 / REE for your 2.3.X sites and 1.9.2 for Rails 3.X sites. No need to pick one specific ruby.

Patrick Robertson

How would that work in a server environment, where I'm running behind Apache 2.2 and Passenger? How would I pick a Ruby in that case?

Walter

RVM has passenger integration documentation on their site that is pretty darn good:

http://rvm.beginrescueend.com/integration/passenger/

Patrick Robertson

You're right. But if you look at the very first item on the page, they say that you have to pick one Ruby for all instances running inside of Passenger. I am running Passenger 2.2.15.

I appreciate the suggestion, but it doesn't seem like it's going to help in terms of being able to run multiple projects with separate Rubies for each.

Is Ruby 1.8.7 compatible both with Rails 2.3.5-8 and 3? Or do you need to be in 1.9.x for Rails 3?

Walter

Alternatively, use a VM like VirtualBox and have a complete isolated
instance to play with, which you can also snapshot/revert easily.

http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/

Yes, Ruby 1.8.7 is compatible with Rails 2.3.x and 3.0. See: http://guides.rubyonrails.org/getting_started.html, in the first section it recommends Ruby 1.8.7 or greater, with a warning about specific versions that are incompatible.

Adam Stegman

Thanks, that sounds like the middle path for me to take with this server. The Passenger stuff sounds like a better project for when I have more time to fiddle, or I get another Xserve.

When I update Ruby from 1.8.6 to 1.8.7, do I need to update gems (speaking in general, I realize the specifics might make a difference). Do gems need to be "compiled" differently for different versions of the language?

Walter

Walter Davis wrote:

Thanks, that sounds like the middle path for me to take with this
server. The Passenger stuff sounds like a better project for when I
have more time to fiddle, or I get another Xserve.

When I update Ruby from 1.8.6 to 1.8.7, do I need to update gems
(speaking in general, I realize the specifics might make a
difference).

I don't see why you would. Since the gems are interpreted, I would
expect then to have all the code they need to run on both versions. (If
they were compiled, I could imagine one version or the other getting
optimized away depending on compilation target.)

Do gems need to be "compiled" differently for different
versions of the language?

Gems aren't compiled at all! Ruby is interpreted.

Some gems have compiled native extensions that are called by Ruby, but I
assume those would be the same between 1.8.6 and 1.8.7.

Walter

Best,

No, native extensions should be recompiled when you upgrade from 1.8.6
to 1.8.7 because the API and ABI has changed slightly.

Thanks all, I think I have my weekend cut out for me! I just encountered a gem update that I thought was minor (friendly_id 1.0.12 to 1.0.13) but which enforced a Ruby 1.8.7 minimum. So I suppose I'm prepared to need to do gem updates to keep everything working. Marnen, how would you identify a "native" extension? Is it a short list?

Thanks,

Walter