how to upgrade Ruby 1.8.7 to 1.9.2

Hello,

I've got an application running on Windows 7 / Ruby on Rails 3.0.4 (Ruby 1.9.2) and I need to move it to production server running on FreeBSD 8.2-RELEASE.

I installed Ruby on Rails 3.0.3 with pkg_add -r rails This also installed Ruby 1.8.7, which is not the version of Ruby I need. I need 1.9.2 and I am trying to upgrade to it but no luck.

I found some instructions of upgrading Ruby with RVM(Ruby version management tool), but I cannot install rvm either (I cloned it from github, but I don't understand how to use it after that)

Are there any solutions to installing Ruby on Rails with Ruby 1.9.2 or upgrading Ruby to 1.9.2?

Thanks in advance!
 
I already did this, I tried both prior to and after Rails installation - no result. Both give the same:
# ruby -v
Code:
1.8.7
 
If all of the ports that depend on Ruby 1.8 will actually work with Ruby 1.9 (not a safe assumption), I would be doing this:
# portmaster -o lang/ruby19 lang/ruby18

And then rebuild all of the ports that depend on Ruby:
# portmaster -r ruby
That will rebuild ruby19 again. It might be possible to combine these two commands to avoid that, but I haven't experimented with it.
 
wblock said:
# portmaster -o lang/ruby19 lang/ruby18

I found a simple solution for the time being:

1. installed Ruby 1.9.2
# pkg_add -r ruby19

2. renamed executable /usr/local/bin/ruby19 to /usr/local/bin/ruby
# mv /usr/local/bin/ruby /usr/local/bin/ruby.bak
# mv /usr/local/bin/ruby19 /usr/local/bin/ruby
# ruby -v

Code:
ruby 1.9.2p136 (2010-12-25 revision 30365) [i386-freebsd8]

It seems like everything works with that "patch".
 
You're optimistic, but probably the worst that would happen is mysterious failures, and it won't be hard to figure out what to blame in that case.
 
mzelensky said:
I simply cannot find installation instructions. Those on rvm site are obsolete and don't work (wrong URLs etc.)

I suggest you set up a FreeBSD jail. rvm is a great tool but since it's outside the ports system it won't trip portaudit when there is an issue.

rvm relies on these tools to be installed:

  • bash (>= 3.2)
  • awk
  • sed
  • grep
  • which
  • ls
  • cp
  • tar
  • curl
  • gunzip
  • bunzip2
  • git w/ svn flag i.e. WITH_SVN=1

You can use which(1) to see if they are there. If your using bash or zsh run the install one-liner and then you will need to put
Code:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
inside your respective profile file.

Rehash and run % rvm install 1.9.2-head

For jruby you'll need java/jdk16

Let me know if this info was helpful.
 
Remove ruby 1.8 installation and all the 1.8-based rubygems packages from the ports (if any).

Code:
cd /usr/ports/lang/ruby18 && make deinstall

Remove the whole /usr/local/lib/ruby directory

Code:
rm -rf /usr/local/lib/ruby

Append
Code:
RUBY_DEFAULT_VER=1.9
in /etc/make.conf to hardlink: ruby1.9 -> ruby

Code:
echo "RUBY_DEFAULT_VER=1.9" >> /etc/make.conf

Install ruby19, reboot and you're done ;)

Code:
cd /usr/ports/lang/ruby19 && make install clean

All FreeBSD ports with ruby-1.8 dependencies will use ruby 1.9 installation files. Install your gems as root, using the gem install way (avoid rubygems from the ports as are outdated)
 
Thanks, vtypal! This is a really simple and very useful solution. It worked! :) Thank you!

# ruby -v
Code:
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-freebsd8]
 
mzelensky said:
OOOPS!
# rails
Code:
rails: Command not found.

some helpful tips to see where rails is

% which rails
% gem list | cut -d" " -f1 | grep rails

Removing the stale gems and reinstalling against your new version will/shouldâ„¢ fix your issue for rails 3.x on your new Ruby.

~
 
Back
Top