Wednesday, January 27, 2010

Trial of Ruby in Ubuntu 9.10

 Ruby the pinnacle of OOP a language described as more object oriented than Python and more powerful than Perl by its creator Yukihiro Maksumoto. I set out to test it on my Ubuntu 9.10. Given ubuntu's excellent support and repositiories no wonder not only ruby but also ruby on rails was available in the respositories. I just had to shoot out the following commands.

Installation



$ sudo apt-get install ruby-full build-essentials
$ sudo apt-get install rails
$ sudo apt-get install vim-ruby
$ sudo apt-get install vim-rails


The same could be accomplished via the synaptic package manager in a more graphical environment by selecting System->Administration->Synaptic Package Manager. Then searching for the packages ruby and rails and selecting both and clicking "Apply".

Soon after installation I went ahead and wrote the following program to test the ruby language.  The benefit of installing vim-ruby and vim-rails is that it helps in using vi with syntax highlighting for ruby and rails.

testString="aaabbbbc"
if testString=~/^a*b*c$/
        print testString, " is in the language a*b*c\n"
else
        print testString, "is not in the language a*b*c\n"
end
testString="aaaaacb"
if testString=~/^a*b*c$/
        print testString, " is in the language a*b*c\n"
else
        print testString, "is not in the language a*b*c\n"
end 
 This completed the test of ruby in Ubuntu. More about ruby over rails later.

No comments: