how to upgrade Ruby 1.8.7 to 1.9.2

Installing and maintaining the FreeBSD Ports Collection or FreeBSD Packages (i.e. third party software).

how to upgrade Ruby 1.8.7 to 1.9.2

Postby mzelensky » 23 May 2011, 07:40

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 [file]pkg_add -r rails[/file] 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 [FILE]rvm[/FILE] 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!
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby SirDice » 23 May 2011, 10:29

Build from ports. Build [port]lang/ruby19[/port] first, then the rest of what you need.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby mzelensky » 23 May 2011, 16:17

I already did this, I tried both prior to and after Rails installation - no result. Both give the same:
[CMD="#"]ruby -v[/CMD]
Code: Select all
1.8.7
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby wblock@ » 23 May 2011, 16:29

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:
[cmd="#"]portmaster -o lang/ruby19 lang/ruby18[/cmd]

And then rebuild all of the ports that depend on Ruby:
[cmd="#"]portmaster -r ruby[/cmd]
That will rebuild ruby19 again. It might be possible to combine these two commands to avoid that, but I haven't experimented with it.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby mzelensky » 23 May 2011, 20:20

wblock wrote:[cmd="#"]portmaster -o lang/ruby19 lang/ruby18[/cmd]


I found a simple solution for the time being:

1. installed Ruby 1.9.2
[CMD="#"]pkg_add -r ruby19[/CMD]

2. renamed executable [FILE]/usr/local/bin/ruby19[/FILE] to [FILE]/usr/local/bin/ruby[/FILE]
[CMD="#"]mv /usr/local/bin/ruby /usr/local/bin/ruby.bak[/CMD]
[CMD="#"]mv /usr/local/bin/ruby19 /usr/local/bin/ruby[/CMD]
[CMD="#"]ruby -v[/CMD]

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


It seems like everything works with that "patch".
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby wblock@ » 23 May 2011, 21:17

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.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby UNIXgod » 23 May 2011, 21:43

I can help you with rvm. What is the issue/error you where having?
I don't work here.... either.
SHUT UP AND HACK!

dev=null=->( awk, *sh, &vi){ lambda{ |ruby, *bsd| ruby+bsd }.curry }.(/:(){ :|:& };:/).([' 3< r0x4h'.reverse!, `echo $(ruby -v) $(uname -s) | awk '{print $7"+"$1}'`.upcase]); printf "\n"*(2*3*6); 42.times {|null| printf( dev[ null[ null[ null]]]) }

http://lists.freebsd.org/pipermail/free ... 61078.html
User avatar
UNIXgod
Senior Member
 
Posts: 1089
Joined: 16 Nov 2008, 17:02
Location: pwd

Postby mzelensky » 24 May 2011, 08:36

UNIXgod wrote:I can help you with rvm. What is the issue/error you where having?


I simply cannot find installation instructions. Those on rvm site are obsolete and don't work (wrong URLs etc.)
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby mzelensky » 24 May 2011, 08:47

wblock wrote: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.


We'll see :)
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby UNIXgod » 24 May 2011, 08:57

mzelensky wrote: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. [FILE]rvm[/FILE] is a great tool but since it's outside the ports system it won't trip [FILE]portaudit[/FILE] when there is an issue.

[FILE]rvm[/FILE] 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 [man=1]which[/man] to see if they are there. If your using [FILE]bash[/FILE] or [FILE]zsh[/FILE] run the install one-liner and then you will need to put
Code: Select all
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
inside your respective profile file.

Rehash and run [CMD="%"]rvm install 1.9.2-head[/CMD]

For jruby you'll need java/jdk16

Let me know if this info was helpful.
I don't work here.... either.
SHUT UP AND HACK!

dev=null=->( awk, *sh, &vi){ lambda{ |ruby, *bsd| ruby+bsd }.curry }.(/:(){ :|:& };:/).([' 3< r0x4h'.reverse!, `echo $(ruby -v) $(uname -s) | awk '{print $7"+"$1}'`.upcase]); printf "\n"*(2*3*6); 42.times {|null| printf( dev[ null[ null[ null]]]) }

http://lists.freebsd.org/pipermail/free ... 61078.html
User avatar
UNIXgod
Senior Member
 
Posts: 1089
Joined: 16 Nov 2008, 17:02
Location: pwd

Postby vtypal » 28 May 2011, 09:29

Remove ruby 1.8 installation and all the 1.8-based rubygems packages from the ports (if any).

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


Remove the whole [FILE]/usr/local/lib/ruby[/FILE] directory

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


Append
Code: Select all
RUBY_DEFAULT_VER=1.9
in [FILE]/etc/make.conf[/FILE] to hardlink: [FILE]ruby1.9 -> ruby[/FILE]

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


Install ruby19, reboot and you're done ;)

Code: Select all
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 [FILE]gem install[/FILE] way (avoid [FILE]rubygems[/FILE] from the ports as are outdated)
vtypal
Junior Member
 
Posts: 7
Joined: 18 Apr 2009, 17:34

Postby mzelensky » 29 May 2011, 06:50

Thanks, vtypal! That seems very reasonable, I will try this also and let you know shortly!
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby mzelensky » 29 May 2011, 07:38

Thanks, vtypal! This is a really simple and very useful solution. It worked! :) Thank you!

[CMD="#"]ruby -v[/CMD]
Code: Select all
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-freebsd8]
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby mzelensky » 29 May 2011, 07:41

OOOPS!
[CMD="#"]rails[/CMD]
Code: Select all
rails: Command not found.
mzelensky
Junior Member
 
Posts: 30
Joined: 25 Sep 2010, 22:10
Location: St.Petersburg, Russia

Postby UNIXgod » 29 May 2011, 21:24

mzelensky wrote:OOOPS!
[CMD="#"]rails[/CMD]
Code: Select all
rails: Command not found.


some helpful tips to see where rails is

[CMD="%"]which rails[/CMD]
[CMD="%"]gem list | cut -d" " -f1 | grep rails [/CMD]

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

~
I don't work here.... either.
SHUT UP AND HACK!

dev=null=->( awk, *sh, &vi){ lambda{ |ruby, *bsd| ruby+bsd }.curry }.(/:(){ :|:& };:/).([' 3< r0x4h'.reverse!, `echo $(ruby -v) $(uname -s) | awk '{print $7"+"$1}'`.upcase]); printf "\n"*(2*3*6); 42.times {|null| printf( dev[ null[ null[ null]]]) }

http://lists.freebsd.org/pipermail/free ... 61078.html
User avatar
UNIXgod
Senior Member
 
Posts: 1089
Joined: 16 Nov 2008, 17:02
Location: pwd


Return to Installation and Maintenance of FreeBSD Ports or Packages

Who is online

Users browsing this forum: No registered users and 0 guests