Install Ruby on Rails 2.0 on Gentoo

Install RoR 2.0

At this date, Ruby on Rails 2.0 is the latest greatest RoR, which is not available in Portage yet.

Ruby language

If you want to install the ruby from source, then download the source from http://www.ruby-lang.org/en/downloads/.

Or, you can use emerge:

# emerge -pv  dev-lang/ruby

Note: If you plan to run gem_server ("gem server" in the later version of Rubygem), on this host, please make sure you have "USE=ipv6" turned on for ruby installation. Otherwise when you run "gem server", you will get an error message "... getnameinfo: ai_family not supported...".

Rubygem

We will skip emerging rubygem from portage and install it from source instead, since we want the latest greatest Rails. Download from RubyGems, extract it, and run ruby setup.rb. At this point, we got /usr/bin/gem18 installed. The note at the end of installation suggested that when we upgrade RubyGems, it is better that we remove gem18 first.

gem_server is now "gem server". On my system, it is "gem18 server", since I haven't done "ln -s gem18 gem" yet.

All gems are installed in /usr/lib/ruby/gems/1.8/.

Install Rails through Rubygem

Again, we have to skip emerging rails from portage, and install it from rubygem repostitory directly. This will get us the latest Rails.

# gem18 install rails --include-dependencies

INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Bulk updating Gem source index for: http://gems.rubyforge.org/
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed rake-0.8.1
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
7 gems installed

Later, when we need to update Rails, we can just do:

# gem update rails --include-dependencies

Reference resources:

Rails 2.0 and Scaffolding Step by Step is a good introduction.

Other references:

Install other helpful items

Dynamic interface and admin plugin

Here are some of the options

Streamlined

Streamlined is a Rails plugin that allows you to quickly generate interfaces for your ActiveRecord models. It started as a way to generate Administrative backends, but has become more general purpose over time.

To install, cd into your application directory, and do:

%  ruby script/plugin install http://svn.streamlinedframework.org/branches/stable/streamlined

Then follow the documents in http://trac.streamlinedframework.org/ to get started.

rcov

rcov: code coverage for Ruby is commonly used for viewing overall test coverage of target code. We can install it via Rubygems:

# gem install rcov