Before We Begin


Before we can start developing Ruby on Rails applications, we'll need to install a few software components - mainly the Ruby language, Ruby on Rails framework, Apache web server and MySQL database.

This installation is one of the ways to get all these software working together on a Windows XP machine.

Installation (8 minutes)

Note: Try to use all the default values as that will make troubleshooting & support easier

   1. Double-click on IZArc_Setup.exe if your computer does not know how to handle .ZIP files
   2. Double-click on Ruby_on_Rails_-_Getting_Started.zip and Extract the files to your Windows desktop
   Note: A new folder called Ruby_on_Rails_-_Getting_Started should be appear on your desktop

   3. Double click on the Ruby_on_Rails_-_Getting_Started folder
   4. Double-click on INSTALL-1 to install Ruby and XAMPP, accept all the default options
   5. Next, double-click on INSTALL-2 to install Ruby on Rails and other useful RubyGems (see Appendix below), also accept all default options

Hello Rails! (3 minutes)

Note: If Windows Security Alert prompt appears, click the Unblock button

   1. Go to XAMPP Control Panel > MySQL and click Start
   2. Go to Start Menu > Run
   3. Type  cmd  and press the Enter key.
   Note: A black console window should appear.

   4. Type (or copy-paste) the following commands into the console, and press the Enter key after each line
cd c:\
c:\xampp\mysql\bin\mysqladmin create helloworld_development -u root
rails helloworld
   Note: This creates a blank, sample Ruby On Rails application. We'll come back to this at Step #6

   5. Leave the console window open, and double-click on INSTALL-3
   Note: This configures Apache and installs some useful Plugins (see Appendix below) for the Rails application we've just created

   6. Type (or copy-paste) the following commands into the console at Step #4, and press the Enter key after each line
cd c:\helloworld
ruby script\server
      The Ruby On Rails web server should be started after the last command, and print out something that looks like:
C:\helloworld>ruby script\server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Ruby version is up-to-date; cgi_multipart_eof_fix was not loaded
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT => stop (no restart).
** Mongrel available at 0.0.0.0:3000
** Use CTRL-C to stop.
   Note: You can already start accessing this sample application by going to the URL http://localhost:3000/

   7. Go to XAMPP Control Panel > Apache and click Start
   8. Finally, go to this URL: http://localhost/ and you should we greeted by the Ruby On Rails greeting page

   9. To shutdown your Rails server, simply close the console window or press CTRL-c into the console window.


Appendix

Installers

One-Click Ruby Installer for Windows

XAMPP for Windows (Apache, Mysql, PHP)

RubyGems

Instead of downloading individual .gem files and installing them 1 by 1 (like what we're doing here), usually we request over the network with 1 command, and all other required gems will be installed for us, e.g.

gem install rails  

Rake: http://rubyforge.org/projects/rake


Rails: http://www.rubyonrails.com/

Mongrel: http://mongrel.rubyforge.org/

Hpricot: http://code.whytheluckystiff.net/hpricot/wiki

XmlSimple: http://xml-simple.rubyforge.org/

Chronic: http://chronic.rubyforge.org/

win32utils: http://rubyforge.org/projects/win32utils

Spreadsheet: http://rubyforge.org/projects/spreadsheet

PDF::Writer: http://ruby-pdf.rubyforge.org/pdf-writer/index.html
color-tools: http://ruby-pdf.rubyforge.org/color-tools/index.html

XMPP4R-Simple: http://code.google.com/p/xmpp4r-simple/


Net::Ssh: http://net-ssh.rubyforge.org/

YahooFinance: http://www.transparentech.com/projects/yahoofinance

Rubyzip: http://rubyzip.sourceforge.net/

RedCloth: http://whytheluckystiff.net/ruby/redcloth/

Tinder (Campfire API): http://rubyforge.org/projects/tinderExamples: http://opensoul.org/2006/12/8/tinder-campfire-api

Rails Plugins

Plugins are usually installed over the network, using a Rails script, e.g.

ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/attachment_fu/

attachment_fu : http://svn.techno-weenie.net/projects/plugins/attachment_fu/


Date Slider : http://techno-weenie.net/svn/projects/plugins/date_slider

GeoKit : http://geokit.rubyforge.org/

Globalize for Ruby on Rails: http://www.globalize-rails.org/globalize/

Gruff : http://topfunky.net/svn/plugins/gruff

HTTP Authentication : http://dev.rubyonrails.org/svn/rails/plugins/http_authentication/

Localization : http://dev.rubyonrails.org/svn/rails/plugins/localization/

Upload Progress : http://dev.rubyonrails.org/svn/rails/plugins/upload_progress/

Yellow Maps for Ruby : http://rubyforge.org/projects/ym4r/

Misc Ruby Libraries

Other than using RubyGems, miscellaneous Ruby libraries can also be included into your Rails application by placing them in the vendor directory. This is often used when the external library on

basecamp.rb : http://developer.37signals.com/basecamp/basecamp.rb

ruby_wrapper.rb (Backpack) : http://www.backpackit.com/api/ruby_wrapper.rb
backpack_calendar.rb : http://backpackit.com/api/calendar/backpack_calendar.rb