Monday, October 23, 2006

Ruby on Rails for Gentoo

First use emerge to install Ruby, next use emerge to install "rubygems"..

Now you can use rubygems to install Rails, ActiveRecord, etc.. You will need to answer Y to each of the dependencies.


# gem install rails
Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency rake? [Yn]
Install required dependency activesupport? [Yn]
Install required dependency activerecord? [Yn]
Install required dependency actionpack? [Yn]
Install required dependency actionmailer? [Yn]
Install required dependency actionwebservice? [Yn]
Successfully installed rails-1.1.6
Successfully installed rake-0.7.1
Successfully installed activesupport-1.3.1
Successfully installed activerecord-1.14.4
Successfully installed actionpack-1.12.5
Successfully installed actionmailer-1.2.5
Successfully installed actionwebservice-1.1.6
Installing ri documentation for rake-0.7.1...
Installing ri documentation for activesupport-1.3.1...
While generating documentation for activesupport-1.3.1
... MESSAGE: Unhandled special: Special: type=17, text=""
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/activesupport-1.3.1/ri --qui et lib
(continuing with the rest of the installation)
Installing ri documentation for activerecord-1.14.4...
Installing ri documentation for actionpack-1.12.5...
While generating documentation for actionpack-1.12.5
... MESSAGE: Unhandled special: Special: type=17, text=""
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/actionpack-1.12.5/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for actionmailer-1.2.5...
Installing ri documentation for actionwebservice-1.1.6...
Installing RDoc documentation for rake-0.7.1...
Installing RDoc documentation for activesupport-1.3.1...
Installing RDoc documentation for activerecord-1.14.4...

Installing RDoc documentation for actionpack-1.12.5...
Installing RDoc documentation for actionmailer-1.2.5...
Installing RDoc documentation for actionwebservice-1.1.6...



After this completes, you can now create a test rails project by issuing the command: "rails test", after changing to your web directory (/var/www/localhost/htdocs/) by default.

# cd /var/www/localhost/htdocs/
# rails photos
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
[...SNIP...]

You can now start the WeBrick webserver included with Rails.

# ruby ./script/server -d test
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
[2006-10-23 12:52:56] INFO WEBrick 1.3.1
[2006-10-23 12:52:56] INFO ruby 1.8.5 (2006-08-25) [i686-linux]

At this point you should be able to point your browser to http://127.0.0.1:3000/ and get the Ruby on Rails Welcome page.

For more information on integration your Ruby on Rails installation with apache2 and FastCGI, please refer to: http://gentoo-wiki.com/HOWTO_RoR.

No comments: