"Give me a place to stand and with a lever I will move the whole world."
With the right tools, even an average guy can fix his own blocked drain.
You do not go into battle an elite airborne division armed with just a spear
and two coconuts ! In the same light, to build this world class application,
we first need the building blocks. In our case, they are Ruby, Gem and Rails,
in that order.
Mandrake normally comes with Ruby pre-installed in a RPM package. My v9.2
has ruby-1.8.0-4mdk installed. This version is no good for Rails and Gem (the
Ruby equivalent of RPM, the de facto Red Hat package installation and
management utility). I found this out after installing Gem, thinking I already
had Ruby. Maybe I should have read the instructions first :-(. Anyway, the
first thing you will have to do is download Ruby 1.8.3, build and install it.
$ wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.3.tar.gz
Resolving ftp.ruby-lang.org... done.
Connecting to ftp.ruby-lang.org[184.108.40.206]:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/ruby ... done.
==> PASV ... done. ==> RETR ruby-1.8.3.tar.gz ... done.
Length: 4,227,276 (unauthoritative)
100%[====================================>] 4,227,276 21.49K/s ETA 00:00
19:23:27 (21.49 KB/s) - `ruby-1.8.3.tar.gz.1' saved 
$ gzip -dc
ruby-1.8.3.tar.gz | tar xvf -
$ cd ruby-1.8.3
$ sudo make install
This will install ruby under /usr/local/bin and all Ruby libraries under /usr/local/lib/ruby.
The next thing to install is gem. According to the Ruby on Rails download
website, all I need to do is to get hold of rubygems-0.8.11 or higher. Nothing
simpler. So I clicked on this link and was taken to the Rubyforge repository,
where I downloaded rubygems-0.8.11.tgz.
$ gzip -dc rubygems-0.8.11.tgz | tar xvf -
$ cd rubygems-0.8.11
$ sudo make install
Looking good. The next thing is Rails.
$ gem install rails --source http://gems.rubyonrails.com
Attempting local installation of 'rails'
Local gem file not found: rails*.gem
Attempting remote installation of 'rails'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-0.14.3
$ rails /home/david/myapp
/usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:3:in `require': no
such file to load -- forwardable (LoadError)
Oops, what went wrong here ? rails was installed successfully, was it not ?
why do I get this error when I invoke rails ? According to the instructions,
all I need to do is run "rails /complete/path/to/new/railsapp" and magic and
fireworks should happen. Well, after about a day scratching my head, turning
on debug, looking at stack trace etc. I finally discovered the problem is to
do with the last step I did. When I installed ruby as root, for some reason
the files were all written out into /usr/local/lib/ruby without world read
$ ls -lrt /usr/local/lib/ruby/1.8
drwxr-xr-x 2 root root 4096 Nov 28 22:26 bigdecimal/
-rw-r----- 1 root root 60 Nov 28 23:06 tkwinpkg.rb
-rw-r----- 1 root root 69 Nov 28 23:06 tkvirtevent.rb
-rw-r----- 1 root root 54 Nov 28 23:06 tktext.rb
-rw-r----- 1 root root 69 Nov 28 23:06 tkscrollbox.rb
-rw-r----- 1 root root 127659 Nov 28 23:06 tk.rb
-rw-r----- 1 root root 63 Nov 28 23:06 tkpalette.rb
-rw-r----- 1 root root 66 Nov 28 23:06 tkmngfocus.rb
OK, so you say, serves him right. It is his own fault for having crazy
permissions. I agree. But look at the error trace above, would I have been
able to determine that is the problem ? I am saying this because this is the
general theme I find in the rest of the installation, in that the ruby stack
traces most of the time do not seem to have any correlation with the actual
system error that will help me zero in on the problem. Searching in Google
does not help that much either because whichever way you go seems to take you
to one of the few main Rails sites, with the procedures all pointing to a
standard Windows installation. At least, I did discover that whenever you get
an error saying 'constant_missing', then it seems to indicate the equivalent
ClassNotFoundException in Java i.e. Ruby could not locate a particular
resource. The class name it is complaining about should be converted into
lower case with embedded underscores in order to locate the actual physical
file it is looking for e.g. ActiveRecord translates to active_record.rb.
$ rails myapp
Caramba ! My first Rails application. Well, at least, the skeleton for my
first Rails application any way. Alas, I rejoice too soon, the rest of the
journey is fraud with fire breathing dragons, green skin ogres, and funny
shaped Trolls. Read on.