metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

ruby 2.0.0 installation

Thu Apr 09, 2015 12:20 pm

How do I get ruby 2.0.0 on my raspberry pi 2 with a text editor setup like python that is preinstalled without messing up sonic pi?
Backspace 28 times :)

richrarobi
Posts: 271
Joined: Sun Feb 08, 2015 1:13 pm

Re: ruby 2.0.0 installation

Fri Apr 10, 2015 11:29 pm

You might have to wait for the next major release of raspbian if 1.9.3(1) is inadequate. With luck it will be in Jessie....
Another option might be to go towards jruby, but even that is messy at present. I am "going through the motions" on a desktop Linux mint with Oracle java 8 and jruby and hopefully applying the same process to my pi2. Heading towards a graph database experiment.
Install oracle java 8 first and the latest jruby should run without compilation as it is a java implementation. (Jruby will use a pi2 more effectively than standard ruby due to better threading model provided by the java base)
RichR
P.s. a search on this site for ruby will provide more background.

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sat Apr 11, 2015 2:05 am

Thank you for replying to my post. I got the book ruby wizardry and it says to get version 2.0.0.
Backspace 28 times :)

PeterWAWood
Posts: 12
Joined: Thu Jul 03, 2014 4:40 am

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 3:12 am

You could install Ruby 2.0.0 using one of the popular version managers, RVM or Rbenv. This would allow you to keep the installed Ruby untouched and switch between it and Ruby 2.0.0 as you wish.

There is a little bit of "fiddling around" to install them so it wouldn't be an ideal solution unless you want to use many different versions of Ruby on your machine.

I installed Ruby 2 versions using Rbenv and made a note of how I did it at http://peterwawood.blogspot.com/2014/07 ... ry-pi.html. There may well be better instructions around if you search for them.

I am trying to find a simpler way to update Ruby on Raspberry Pi. If I succeed I'll try to let you know.

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 3:53 am

Thanks, this might help. I don't know how to "do" a bash file yet but I'm sure I'll figure it out in a couple of hours (YouTube). I'm really excited to get started on this book and see how ruby compares to python.
Backspace 28 times :)

PeterWAWood
Posts: 12
Joined: Thu Jul 03, 2014 4:40 am

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 6:53 am

Actually, I believe that Ruby 1.9.3 code will run happily under Ruby 2+. As I understand, the main changes between Ruby 1.9 and Ruby 2.0 are some additions to the language and the default encoding for text encoding being changed to UTF-8.

To check, I installed Ruby 2.2.1 on a Raspberry Pi by downloading the source from ruby-lang.org and compiling it. (I simply followed the instructions on the installation page of the Ruby website).

I was able to run Sonic Pi after the Ruby 2.2.1 was installed. (I haven't used Sonic Pi so I couldn't really test it.)

Ruby 2.2.1 is installed into the /usr/local/bin/ directory, the "official" Ruby is installed in the /usr/bin/ directory so both are still installed on your machine.

Ruby 2.2.1 will become the default Ruby though you can still run Ruby 1.9.3 by specifying /usr/bin/ruby in the command line:

Code: Select all

pi@raspberrypi ~ $ ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [armv6l-linux-eabihf]

pi@raspberrypi ~ $ /usr/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [arm-linux-eabihf]

pi@raspberrypi ~ $ irb
irb(main):001:0> RUBY_VERSION
=> "2.2.1"

pi@raspberrypi ~ $ /usr/bin/irb
irb(main):001:0> RUBY_VERSION
=> "1.9.3"
The only slight downside of this is that you will need to manually check for new Ruby releases.

Hope this helps.

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 7:37 am

I tried sudo apt-get install ruby 2.0.0 and it installed something but when I tried ruby -v it said it was the old version and it was not listed in the GUI where the python stuff is under languages. Also I tried something from the books Linux installation in "appendix a" and that failed mabey because I put a space in the wrong place. I gave up and held down shift and re-did the rasbian installation just because I was making a mess while downloading tuxcart which doesn't work and hydrogen which sounds like a helicopter and tuxguitar which has no sound (mabey I need a separate midi package?). But that's what's great about the pi and noobs you can always start over. Anyway I guess I'll focus on python and scratch until I run out of material and by then there might be a fool proof step by step I can follow. I'm real new at this stuff and I appreciate your help.
Backspace 28 times :)

PeterWAWood
Posts: 12
Joined: Thu Jul 03, 2014 4:40 am

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 9:23 am

I downloaded the 2.2.1 source from https://www.ruby-lang.org/en/downloads/ using Epiphany. Clicking on the link for the source code for Ruby 2.2.1.

When it was downloaded, the extract window popped up and I extracted. The suggested location would be fine: pi/downloads/ruby-2.2.1

Next I opened the terminal application and entered the following commands, one at a time:

cd downloads/ruby-2.2.1
./configure
make
sudo make install

The last one takes a very long time but you can just leave it running (It will be quicker on a Pi 2).

neilcford
Posts: 4
Joined: Fri Mar 09, 2012 10:26 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 12:58 pm

A couple of points:
metalj wrote:I tried sudo apt-get install ruby 2.0.0 and it installed something but when I tried ruby -v it said it was the old version and it was not listed in the GUI where the python stuff is under languages.
Ruby has no inbuilt GUI tools so there would be nothing to put in to the menus of your desktop environment. As long as you have a terminal program, you have everything you need to run Ruby.
metalj wrote:then there might be a fool proof step by step I can follow. I'm real new at this stuff and I appreciate your help.
The instructions Peter has give above are really as fool proof as they get. As mentioned before there are tools to allow you to manage multiple Ruby environments, but they are probably much more than you need. Take a look at ruby-install https://github.com/postmodern/ruby-install which might make installing the latest version of Ruby a little easier.

As for a text editor, the world is pretty much your oyster there. You can use whichever one you are most comfortable with, though if you want syntax highlighting, not all available options might support it. Personally I use Vim, but I'm an old school unix person, you might find something like GEdit easier to get on with.

Ruby Wizardry is an awesome book. Don't give up on it just yet.

- Neil.

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 8:19 pm

You people make this forum the best. I'm going to try the epiphany instructions from peter. Now once I download it I get the suggested text editor, then how do I tell the editor that I want to use ruby? I figure that I can't just click on ruby.exe. I definitely want an editor that highlights syntax mistakes and has been tested on the pi2 and works with the GUI if possible. Gedit and sublime text 2 are recommended in the book.
Backspace 28 times :)

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 9:29 pm

When I ran make I got a warnings is that normal? It did not stop the process though. Also the letter d in the word downloads needed to be capitalized. Also getting failed to configure it will not be installed notices.
Backspace 28 times :)

metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 10:28 pm

Everything worked out as far as I can tell. I sudo apt-get install gedit and found it in the GUI then tried the put command in a script saved it as a .rb file the ran it from the command line. This is so cool!!
Backspace 28 times :)

PeterWAWood
Posts: 12
Joined: Thu Jul 03, 2014 4:40 am

Re: ruby 2.0.0 installation

Sun Apr 12, 2015 10:45 pm

Great !! I'm sure that you are going to enjoy learning Ruby.

DDSSK13
Posts: 6
Joined: Thu Jul 09, 2015 4:40 pm

Re: ruby 2.0.0 installation

Thu Jul 09, 2015 5:15 pm

I got ruby up on my raspberry pi, what now. Any good books or websites?

User avatar
B.Goode
Posts: 10191
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: ruby 2.0.0 installation

Thu Jul 09, 2015 8:36 pm

DDSSK13 wrote:I got ruby up on my raspberry pi, what now. Any good books or websites?
http://www.ruby-lang.org

http://learnrubythehardway.org

DDSSK13
Posts: 6
Joined: Thu Jul 09, 2015 4:40 pm

Re: ruby 2.0.0 installation

Fri Jul 10, 2015 7:36 pm

B.Goode wrote:
DDSSK13 wrote:I got ruby up on my raspberry pi, what now. Any good books or websites?
http://www.ruby-lang.org

http://learnrubythehardway.org
Thanks! ;)

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: ruby 2.0.0 installation

Fri Jul 10, 2015 10:10 pm

Now that you have been initiated into the world of getting Ruby to run perhaps it's time to put that aside and catch up with the modern world of node.js :)
Memory in C++ is a leaky abstraction .

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: ruby 2.0.0 installation

Thu Jul 30, 2015 9:15 am

DDSSK13 wrote:I got ruby up on my raspberry pi, what now. Any good books or websites?
i just try http://shoesrb.com/ Shoes http://shoes.mvmanila.com/public/shoes/ ... hf.install
chmod +x shoes-3.2.23-gtk2-armhf.install
./shoes-3.2.23-gtk2-armhf.install
http://kll.engineering-news.org/kllfusi ... s_app2.png
great!!!
i did it on a fresh SD card ( ruby -v :1.9.3 )
but also after i got a ruby 2.2.1 running, actually i don't know which one Shoes uses?

Return to “Other programming languages”