Getting Started with Ruby on Rail in Eclipse

I want to run a test app in ROR. Of course I want this to work in Eclipse so I looked around to see how to do it. After reading a few things and making a few mistakes, here is how I did it.

First Install Ruby

  • Install Eclipse DLTK Plug-in. Select just the core and the ruby items
  • Install Ruby Interpreter
    sudo apt-get install ruby-full
    
  • Point Eclipse to Ruby. Window -> Preferences -> Ruby -> Interpreters. /usr/lib/ruby
  • Test
    • Create new Ruby Project
    • Create new Ruby Script File
        puts "Hello there!"
      
    • Run as Ruby Script
  • Install Rubygem
      wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
      tar zxvf rubygems-1.3.7.tgz
      cd rubygems-1.3.7
      ruby setup.rb
      ln -s /usr/bin/gem1.8 /usr/local/bin/gem
    

Install SQLite and Rails

# Install SQLite
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

# Now Rails
gem install rails

Configure Eclipse to Create Rails Projects

  • Select Run -> External Tools -> External Tools
  • Select “Program” from the configuration tree
  • Select New to create a new program
  • Enter “Create Rails Application in Project” as the name
  • Enter /usr/bin/rails for the Location
  • Enter ${project_loc} for the Working Directory
  • Enter new ../ ${project_name} for the Arguments
  • Select the refresh tab and check Refresh Resources Upon Completion
  • Select the Common tab
    • Find the section for Display in Favorites Menu
    • Check the box next to External Tools
    • Select Apply

Notes

I installed both mysql and sqlite3. Although I think I already had mysql on the machine.

Resources