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
- gems\activesupport-1.4.2.gem gems\activerecord-1.15.3.gem
gems\actionpack-1.13.3.gem gems\actionwebservice-1.2.3.gem
gems\actionmailer-1.3.3.gem gems\rails-1.2.3.gem
- gems\fastthread-1.0-mswin32.gem gems\cgi_multipart_eof_fix-2.2.gem
gems\gem_plugin-0.2.2.gem gems\mongrel-1.0.1-mswin32.gem
gems\mongrel_cluster-1.0.2.gem
- gems\xml-simple-1.0.11.gem
- gems\needle-1.3.0.gem gems\net-ssh-1.1.2.gem gems\net-sftp-1.1.0.gem
- gems\yahoofinance-1.2.1.gem
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/
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
- Example: http://rossbelmont.vox.com/library/post/create-backpack-reminders-via-emailsms.html