Ruby/Rails

Develop Ruby Applications Using Komodo IDE

0

Komodo is another excellent IDE for developing Ruby, Perl, Python, PHP and Tcl applications. Unlike it is with developing Ruby applications in Eclipse, no additional plugins need to be installed for Komodo; the Ruby support is inbuilt in this IDE. The IDE also has built-in support for integrating with source control software(in professional edition only) like CVS, Subversion and Perforce. All these software only need to be installed and in path for Komodo to start using it.

Downloading and Installing Komodo IDE

Download the Komodo IDE from the following page:

Buy Komodo Personal or Professional Edition
Try Komodo Personal or Professional Edition

After getting the software downloaded, the installation is as easy as running a couple of commands, as it comes with its own installation script. I recommend installing the IDE in the user’s home directory, but if multiple users access the computer, and want to use Komodo, then it can be installed in the system path too.
Run the following commands to install Komodo in the home directory:

sh# tar -xvzf Komodo-Personal-3.5.2-227956-linux-libcpp5-ix86.tar.gz
sh# mv Komodo-Personal-3.5.2-227956-linux-libcpp5-ix86 komodo3.5
sh# cd komodo3.5
sh# ./install.sh

(substitute the name of the downloaded file in the above command.)

Answer the questions asked by the installer(like where to install Komodo) or accept the default values. To add Komodo application to the path, add the following line to the user/system profile file(eg: ‘.bash_profile’):

export PATH=/home/user/komodo3.5:$PATH

Before Komodo can be used, a license has to be properly setup. You might have recieved a license file through email while purchasing the product; you can request a license for the trial version otherwise, if you want to evaluate the product. Once you get hold of a license, its time to install it. I have a license for Komodo Personal Edition and this is how I have installed it:

sh# chmod +x License-KomodoPersonal-Linux
sh# ./License-KomodoPersonal-Linux

The file name of your license may be different depending upon the version of Komodo you are using.

After the installation is complete, a shortcut link for the Komodo IDE can be seen on the desktop. Click the icon to start the IDE(or run ‘komodo’ on the command line):
Komodo Desktop Icon

Create Ruby Applications Using Komodo IDE

Komodo IDE starts with the following welcome screen. From here you can create a new project, open the existing projects or browse through the various tutorials.
Komodo Main Window

To browse through the Ruby tutorial and reference, click the “Ruby Tutorial” link in the main window. The tutorial will be opened in a new browser window.
Komodo Tutorial Window

Editing Ruby programs in Komodo in full screen mode looks like this(Syntax is colorised, indentation is done etc. Usual stuff expected of an IDE).
Komodo Fullscreen Editor

To create a new Ruby project in Komodo, select File->New Project, enter a name for the project and click the “Save” button. Now create a new Ruby file by selecting File->New File and selecting “Ruby” from “Templates”.
Create New Ruby File in Komodo

Type the program in the editor and save the file.
Sample Ruby File in Komodo

To evaluate simple Ruby expressions, Ruby interactive shell can be used from within Komodo. Select “Start New Ruby Shell” from the drop down box in the toolbar(or Tools->Interactive Shell menu) to start an interactive shell. Evaluate the Ruby expressions in the newly opened ‘Ruby Shell’ tab at the bottom of the window.
Ruby Interactive Shell in Komodo

The Ruby interactive shell can be made the default shell in Komodo and be bound to F12 hot key from the Preferences(Edit->Preferences) dialog box.
Ruby Interactive Shell in Komodo

End Notes

Komodo IDE provides a very rich program development environment for many popular scripting languages like Ruby, PHP, Perl, Python and Tcl. The personal(non-commercial) edition has most of the features of the professional edition and costs only tenth of its price. You may also get lucky and be able to find a discount coupon on the Internet to buy the personal edition of Komodo free of cost. Moreover, one license of Komodo(whether personal or professional) allows the software to be run on multiple platforms like Windows and GNU/Linux. If you want to use one IDE to develop programs on multiple platforms and using multiple scripting languages, without the hassle of installing additional plugins to get such a support, then Komodo is definitely worth a try.

Develop Ruby Applications Using Eclipse IDE

11

Eclipse is one of the most popular programming IDEs available today. Very few development environments can stand against it in terms of features or ease of use. Except for editing very small/few number of files, for which the fast responsiveness of the simple editors might be more desirable, Eclipse is becoming the most preferred development environment. Its flexible plugin system has allowed the community to work towards enhancing/adding new functionality to the core product, just like it happened with emacs. The open source license and the plugin system has aslo meant that the IDE today supports most of the popular programming languages making Eclipse far more that just a Java IDE. One such language supported by Eclipse with the support of plugins is Ruby. If you are a Ruby/Rails developer, then you must definitely give Eclipse + Ruby plugin a try.

Download and Install Eclipse

Skip this section if you already have Eclipse installed on your system.

One way to install Eclipse would be to use the appropriate package manager for your distribution like apt, emerge, yum, yast etc. If you want the latest version though, downloading it separately and uncompressing it in the home directory would be an ideal way. In this case, follow these steps:

  1. Download Eclipse from here.
  2. Extract the downloaded file in the home directory(say /home/user).
  3. Make sure atleast the Java runtime(JRE) is installed(complete Java SDK is required to create Java programs from Eclipse) on the system. Go to the extracted directory and run the ‘eclipse’ executable file to check if everything is working properly.

Downloading and Installing Ruby plugin for Eclipse

Follow these steps:

  1. Download the Ruby plugin for Eclipse by selecting a mirror from here
  2. Extract the downloaded file in a temporary directory(say /home/user/temp).
  3. Copy the contents of the extracted directory in the corresponding Eclipse folders:
    /home/user/temp/features/* —-> /home/user/eclipse/features/
    /home/user/temp/plugins/* —-> /home/user/eclipse/plugins/

    (Use the path to the Eclipse installation folder if its not installed in the home directory).

  4. Confirm if the Ruby plugin is successfully installed by starting the eclipse IDE and going to Help->About Eclipse SDK->Plug-in Details.
  5. Scroll down the list of installed plugins to find the Ruby plugin.

Configure the Ruby plugin

Before being able to create Ruby programs from Eclipse, we need to provide it with the information regarding where Ruby is installed. If Ruby is not already installed, then install it first. Then follow these steps:

  1. Start Eclipse IDE and go to Window->Preferances->Ruby->Installed Interpreters->Add.
  2. Enter the following details:
    Interpreter Name: ruby
    Location: /usr/bin/ruby

    To find the location where ruby is installed on your machine, run the following command:

    sh# which ruby
    /usr/bin/ruby

  3. Now go to Window->Preferances->Ruby->Ri/rdoc and enter the following information:
    RDoc Path: /usr/bin/rdoc
    Ri Path: /usr/bin/ri

  4. Fill whatever location you have found out in the earlier step using `which` command.

Creating a Sample Ruby Application From Eclipse

  1. To create a Ruby application, create a Ruby project from File->New->Project
  2. Select Ruby->Ruby Project. Click ‘Next’, enter a project name and click ‘Finish’.
  3. Select File->New->Ruby Class to create a new class or select File->New->File to create a simple Ruby file. Type a program in the editor and save it.
  4. Now right-click on the file name and select Run As->Ruby Application to run the script.
  5. You can also debug the Ruby programs from within Eclipse. Click the ‘Debug’ button on the toolbar and select a Ruby script to start debugging it.

    The debugger is started and ready.

Other excellent development environments for Ruby application development include Komodo IDE, Emacs, Vim, SciTE etc. I will try to write about these development environments in the next few posts.

Installing Ruby on GNU/Linux(Gentoo, (K)Ubuntu, Fedora, SUSE) And MS Windows

7

Installing Ruby on Gentoo:

To install Ruby on Gentoo, run the following command(as root) in a shell:

sh# emerge ruby ruby-mode

You can add a few ‘USE’ keywords if you want to install additional Ruby support(like database integration, CGI support etc). Add the following line to the /etc/portage/package.use file(keywords that are already present in ‘USE’ flag of /etc/make.conf file need not be added):

dev-lang/ruby docs examples fastcgi mysql

‘ruby-mode’ adds the ruby mode to the Emacs editor while editing .rb files. Use ‘ruby-modes’ to add similar support to XEmacs. You need to add some text to .emacs file from your home directory; see this to know how to do it.

Installing Ruby on (K)Ubuntu:

Preparation:

A little note before you start installing Ruby on (K)Ubuntu:
There are two versions of Ruby available in the Ubuntu repositories:

  • Ruby 1.8.4
  • Ruby 1.9.0

1.8.4 version can be installed by appending 1.8(Eg. ruby1.8, irb1.8 etc) to the respective package names. Similarly, 1.9 version can be installed by appending 1.9(Eg. ruby1.9, irb1.9 etc) to the respective package names. If nothing is appended(Eg. ruby, irb etc), what debian considers as default version of ruby(currently 1.8.4) will be installed.

Once Ruby is installed, the command to invoke the Ruby interpreter would depend on which version of it is installed. Like, if ruby1.8 is installed, ruby can be invoked using ‘ruby’ or ‘ruby1.8′ commands(‘ruby’ will be a symbolic link to ‘ruby1.8′):

sh# ruby1.8 first.rb
sh# ruby first.rb
sh# ls -l `which ruby`
lrwxrwxrwx 1 root root 7 2006-07-18 18:47 /usr/bin/ruby -> ruby1.8

(the quotes in the third command are inverted quotes and not single quotes)

Use ‘ruby1.9′ if 1.9 version is installed.

If all this sounds confusing, just follow my recommended way of installing Ruby and skip the ‘Optional’ part.

My recommended way of installing Ruby on (K)Ubuntu:

To install Ruby on Ubuntu family of operating systems, type the following command in a shell:

sh# sudo apt-get install ruby ruby1.8 libruby1.8 irb irb1.8 rdoc rdoc1.8 ri ri1.8 ruby1.8-examples ruby1.8-elisp ruby-manual rubybook

(Or search and install these packages using Synaptic(on Ubuntu) or Adept(on Kubuntu) Package Manager.)

Running commands like ‘ruby’, ‘irb’ etc will invoke the latest stable versions:

sh# ruby -v
ruby 1.8.4 (2005-12-24) [i486-linux]
Optional

To install the 1.9 version(which is not stable as of now), use the following command:

sh# sudo apt-get install ruby ruby1.9 libruby1.9 irb irb1.9 rdoc rdoc1.9 ri ri1.9 ruby1.9-examples ruby1.8-elisp ruby-manual rubybook
sh# ruby -v
ruby 1.9.0 (2006-04-21) [i486-linux]

Of course you can also have both 1.8.4 and 1.9 versions installed on the system at the same time. Run the following command to do so:

sh# sudo apt-get install ruby ruby1.8 ruby1.9 libruby1.8 libruby1.9 irb irb1.8 irb1.9 rdoc rdoc1.8 rdoc1.9 ri ri1.8 ri1.9 ruby1.8-examples ruby1.9-examples ruby1.8-elisp ruby-manual rubybook

In this case, use ‘ruby’ to execute the 1.8.4 version of the interpreter and use ‘ruby1.9′ to run the 1.9 version.

sh# ruby -v
ruby 1.8.4 (2005-12-24) [i486-linux]
sh# ruby1.9 -v
ruby 1.9.0 (2006-04-21) [i486-linux]

What about ruby-gems?

I don’t recommend installing additional Ruby packages using the ‘rubygems’ utility if you use a distribution specific package manager(apt, emerge etc) to manage the software on your system. Debain community strongly discourages its use to install the ruby packages(rightly so), as it doesn’t follow the package management conventions of Debian’s package manager(and hence can mess up with it and stop it from working properly). Same goes for Gentoo OS too. Go here to read more information on this. But if Ruby is (one of) the most important software for you, then ‘rubygems’ can make it very easy to install the latest versions of Ruby related software, long before they are added to the Debian or Gentoo repositories. In that case, follow the documentation on how to install ‘rubygems’ and how to install Ruby packages using it from this page.

In Gentoo, you can do this:

sh# emerge rubygems

Installing Ruby on Fedora/SUSE/Mandriva etc:

Use RPMs! Hunt them down using google.com or rpmfind.net and then install them one by one in the order.
Or use the package manager of each distribution(‘yum’, ‘yast’ and ‘urpmi’ respectively) and hope for the best. I have tested with yum and yast and at least they did not create too many issues for me:

Ruby on Fedora using yum:

If the yum configuration files(fedora.repo etc) are properly setup, you can install Ruby using the following command:

sh# yum install ruby.i386 ri.i386 ruby-mode.i386
sh# ruby -v
ruby 1.8.4 (2005-12-24) [i386-linux]

Above command will install ruby, irb, ri, rdoc commands and Ruby mode for Emacs. You need to add the following line to ‘.emacs’ file present in your home directory(create it otherwise) to enable Ruby mode in Emacs editor:

(require ‘ruby-mode)

On SUSE, use YaST to install ‘ruby’, ‘ruby-doc-ri’ and ‘rubygems’ packages by searching for them from the YaST interface(YaST->Software Management->Search).

sh# ruby -v
ruby 1.8.2 (2004-12-25) [i586-linux]

‘ruby’ and ‘rubygems’ are available on the SUSE 10.1 DVD itself; you can add repositories from the Internet to install the other Ruby packages(ruby-docs-ri etc), or use ‘rubygems’ to install them.
Add the following in the YaST configuration (YaST->Installation Source) if you want to install ‘ruby-docs-ri’ from the Internet:

Protocol: FTP
Server Name: ftp.mirrorservice.org
Directory on Server: /distribution/SL-10.0-OSS/inst-source/
Authentication: Anonymous

Another way would be to simply download all the needed RPM files by manually searching for them on the web and installing them directly without bothering with yast. Same can be done for Mandriva and other RPM based distributions.

Installing Ruby on Microsoft Windows:

Download the Ruby Windows installer file from the following url: Ruby 1.8.4
(blog entries become outdated very soon; this is version 1.8.4, currently the latest stable version. Always Google for the latest stable version to check if this url still useful to compensate my laziness in updating the above link once a new version is released. 40+ words waster for the lack of Package Manager in Microsoft Windows.)

Click on the installer file and follow the wizard. Once finished, you have three ways to run your Ruby programs(assuming its Windows XP):

All the menu items are available at: Start->All Programs->Ruby-184-19, so first go there.
Menu for Ruby Programs
Then,

  1. Select fxri-Interactive Ruby Help & Console menu item to load the interactive Ruby interpreter. Run your Ruby programs at the 'irb' prompt.

    Interactive Ruby Shell(irb) And Help

  2. Select FreeRIDE menu item, which will open a minimal IDE to write, debug and run Ruby programs.

    FreeRIDE IDE For Ruby

  3. (Recommended)Use SciTE editor.
    Select SciTE menu item. This will open the excellent editor called SciTE that supports many programming languages other than Ruby, and is also available for many other operating systems(including GNU/Linux). Its one of the best programming editors available today.

    Programmable Editor SciTE for Ruby

After finishing editing and saving the program with SciTE, go to the command prompt(Start->All Programs->Accessories->Command Prompt), change to the directory where you have saved the program and run it using the 'ruby' command.

C:\myprogs>ruby first.rb

End Note:

This article describes the installation of basic Ruby software. There are many related packages that can be installed to get additional functionality, like database bindings for popular database software(mysql, postgre), email support, gui programming(gtk, qt), rails, soap etc. Hopefully, I will cover installation of these packages in a future article(also planning to post an article on using various popular IDEs(Eclipse, Komodo) to create Ruby programs in Windows and GNU/Linux OS), so check back if you are interested.

buy prednisone medication COD purchase prednisone without prescription needed purchase prednisone prescription online prednisone no prior script prednisone no rx needed order prednisone usa cod buy prednisone without rx from us pharmacy buy prednisone online without rx purchase prednisone without prescription order prednisone saturday delivery buy prednisone amex online without prescription ordering prednisone over the counter buy prednisone amex online without rx ordering Paxil over the counter order Paxil without rx needed order Paxil pharmacy Paxil overnight delivery fed ex ordering Paxil without a script order Paxil order amex order Paxil amex online without prescription buy Paxil pay pal without prescription order rx free Paxil cheapest Paxil available online purchase Paxil without purchase Paxil without prescription how to order Paxil online without a prescription purchase Paxil cod next day delivery buy discount Paxil online buy Paxil no visa online without rx prednisone cheap overnight fedex purchase Strattera usa cod where to buy accutane buy frontpage software cheap mortgage application software buy autocad software best price for final draft 7 software iphone software download plagiarism software to buy for parents Crestor side effects buy masterwriter software discount bmi sesac microsoft software downloads wm5 software download treo software download cheap discount software xxasdf discount trellian software best antivirus software download cheap microsoft word software buy software for mac software discounts for educators microsoft office buy windows xp oem software buy flash cs3 software photoshop cs 5 full fashion conference italy buy Orlistat with amex ordering Lasix over the counter purchase online prescription Lasix without windows 7 product key purchase online cheapest xenical available online prescription xenical online online Maxalt achat Maxalt Zithromax uk sales where to buy Valtrex by cod where to purchase generic valtrex online without a prescription quality generic valtrex cheap valtrex usa (no prescriptions needed for Buspar|buy Buspar with no prescription|online pharmacies Buspar|Buspar cheap|buy Buspar without rx|purchase rx Buspar without|Buspar purchase online|purchase Buspar online without rx|purchase Buspar free consultation|buy Buspar Online|buy Buspar american express|buy Buspar Online|buy cheap Buspar with dr. prescription|Buspar side effects|fedex Buspar without priscription|overnight Buspar without a rx|order cheap overnight Buspar|Buspar toronto|uk order Buspar|Buspar no doctors prescription|Buspar mexico|Buspar order|no prescription Buspar with fedex|order generic Buspar|buy Buspar without rx from us pharmacy|prezzo Buspar|Buspar 10mg|Buspar from canada|purchasing Buspar without a script|buy Buspar australia|purchase Buspar visa without prescription|online purchase Buspar|buy Buspar no perscription cod|buy Buspar drugs|buy Buspar with visa|buy Buspar without rx needed|buy Buspar without prescription|buy Buspar no prescription low cost|purchase purchase Buspar no prescription cheap buy cheap Nolvadex cod buy Nolvadex infertility in internet visa at Wisconsin Ontario omicrosoft office 2003 megaupload online purchase Lasix Buy genuine accutane online buy Cytotec online no rx Cytotec online buy nolvadex amex online where to buy synthroid in germany where to buy synthroid pills cheap discount Nolvadex overnight Accutane 20mg mexico order Lasix usa Lasix overnight delivery fed ex buy zithromax overnight purchase online prescription zithromax without buy Nolvadex cheap cheapest Nolvadex available online buy Nolvadex without rx from us pharmacy buy Nolvadex without a prescription overnight delivery buy 20mg Nolvadex free shipping buy Nolvadex no prescription order zithromax overnight delivery buy zithromax 100 mg visa Valtrex without doctor prescription buying zithromax over the counter order zithromax with no prescription order zithromax 250mg mastercard order zithromax 250 mg visa order zithromax 500mg amex buy mail order Orlistat buy Valtrex online now Orlistat tablets purchase cheap Maxalt onlinebuy generic Maxalt pills free fedex delivery Buspar buy cheap Finpecia under without rx purchase online finpecia without rx finpecia fedex no prescription buy line finpecia generic Crestor uk Buspar u.p.s shipping cod order cheap overnight Buspar free fedex delivery prednisone prednisone no script fedex buy valtrex cheap without prescription generic Valtrex fedex Online overnight shipping Valtrex purchase Zithromax without purchase Zithromax no scams Arimidex delivered overnight order cheap overnight Arimidex purchase Cytotec over the counter fedex buy Cytotec online overnight adobe financial results microsoft office professional 2007 upgrade download microsoft office professional 2007 cheap Buspar by money order how to buy Valtrex without a prescription cheap valtrex uk buy Flomax in the uk purchase Proscar usa cod adobe lm service adobe after effects simple creativity latest adobe flash download buy Crestor amex measurement software Photoshop For Sale buy discount Tamsulosin line Autocad 2010 Review download adobe premiere complete removal of office 2003 adobe indesign cs2 photoshop lightroom 3 cheap where can i buy herbal Crestor where to buy Crestor buy Crestor online cod Buy Fincar online 5 mg mastercard cheapest price for microsoft office vio software discount coupon purchase Orlistat amex online without prescription buy maxalt online without a prescription adobe photoshop 6 cd key Cheap Software Buy Downloads For Photoshop flash catalyst sql ms office 2010 enterprise windows 7 upgrade oem Windows Server 2003 Standard Edition Downloads For Windows 7 Ultimate Buy cheap Valtrex without a perscription application free download office microcoft2007 buy Crestor drugs Valtrex no prescription purchase Valtrex amex online without prescription Xenical Orlistat Flomax buy on line boilsoft viseo create new instrument logic studio 9 cheap purchase finpecia buy Strattera no prescription low cost Flomax best buy buy cheap oem software formica countertop cyberlink power dvd 9 download buy Prednisone no prescriptions cheap indesign cs android acdsee buy Flomax australia generic Valtrex online lightroom license .txt download de driver para corel windvd buy microsoft office online cheap generic Valtrex online buy Flomax online no prescription buy pharmacy Flomax waterview ifinance price price of valtrex buy valtrex doctor prescription buy generic Crestor order generic Tamsulosin imtoo dvd ripper serial look like buy Buspar without a rx cheap digital video want to buy Buspar in malaysia buy Crestor now buy Valtrex without a rx purchase rx Valacyclovir without Bupropion buy Bupropion buy no perscription Amitriptyline buy discount Zithromax cheapest Zithromax available online how to order Buspar online without a rx purchase prednisone cod next day delivery where can i purchase prednisone online prednisone online cash on delivery microsoft office 2010 3 user license cheap mac desktops no prescription Orlistat cod delivery Work Order Tracking System Acrobat 6.0 Professional Oem Version Windows 7 buy Valtrex where order Orlistat no rx cheap proffes Microsoft Windows Xp Purchase buy Valtrex legally buy cheap Proscar without prescription Windows Xp Server buy cheap online pharmacy Buspar buy Prednisone online now generic Zithromax usa accutane 40 mg delivered overnight buy accutane 40 mg with no prescription media 8 oline cheap cs software Discount Microsoft WindowsLightroom 2 Windows 7Ms Office StandardPhotoshop Cs5 UpgradeComputer Monitors For SaleWindows Xp InstallSuite Microsoft OfficeAutocad Version 2007Adobe Acrobat 9.0 Standard DownloadIe8 Download For Windows 7Adobe Paint ShopMicrosoft Service Pack 2Free Download Adobe AcrobatStudent And Teacher EditionManage ImageAdobe Acrobat 7 Pro DownloadVista Home Premium To Windows 7 UltimateWindows 7 Home Premium Upgrade OemAdobe Creative Suite 5 Master Collection Student And Teacher EditionBuy Adobe Photoshop Lightroom 3Ms Office 2010 Home And StudentCompare Photo SoftwareMicrosoft Office Word Viewer 2010Windows 7 Upgrade Student Discount ProfessionalWindows 7 Updates DownloadCreative Suite WebAdobe Reader VistaMicrosoft Windows 7 Home Premium Upgrade 64 BitPhotoshop 2Ie8 Download For Windows 7Photoshop 2009Suite Microsoft OfficeMicrosoft Office 2007 VersionUpgrade Windows Vista To 7Autocad Lt 2010Autocad 2010 Best PriceDownload Acrobat Reader 8 buy Flomax online us pharmacy cheapest Buspar available online where can i purchase Buspar without a prescription sony oem software Valtrex from india Maxalt pharmacy Prednisone prescription order Buspar shipped by cash on delivery purchase Proscar online with overnight delivery buy Valtrex with no prescription prezzo Valtrex buy Valtrex shipped cod Proscar no prescription overnight Proscar overnight no consult where to purchase cheap Cytotec no rx Cytotec to buy canadian prescriptions prednisone where to buy Prednisone online Prednisone buy Prednisone Proscar online no rx overnight where can i buy Valtrex online without a prescription buy valtrex legally order Valtrex without a rx overnight shipping c.o.d prednisone purchase Prednisone money purchase is it legal to buy Cytotec online in australia buy Cytotec cheapest buy finpecia without prescription finpecia buy cod want to buy finpecia in malaysia buy finpecia with mastercard Buy Finpecia 1 mg online microsoft onenote and educator discount window mirror film charset windows 1252 reinstal windows finpecia overdose excel new window windows for loop microsoft office 2008 for mac home student cheap collection software virtual dj software web design software mac cheap or discount photoshop software load windows xp buy Orlistat legally Rosuvastatin generic order buspar pharmacy buy Flomax in mo dreamweaver cs4 windows mobile opera adobe photoshop price epson creativity suite
Go to Top