Next → Eleventh Step, Refactor with AspectHelper Ninth Step, Prettify ← Prev

Tenth Step, Configuration

To round up this tutorial a bit, let's introduce you to configuration in Ramaze. This will not go into full depth of possibilities or a total coverage of the options, since they are bound to change over time.

First of all, the default port Ramaze runs on is 7000, but to make it a usual webserver it has to run on port 80. So, let's add following line in your start.rb right after the lines of require you added before:

Ramaze::Global.port = 80

Alright, that wasn't that hard. Let's say now you also want to run Mongrel instead of WEBrick, to get nice a bit of performance:

Ramaze::Global.adapter = :mongrel

To do this in a DRY way you could also do following:

Ramaze::Global.setup do |g|
  g.port = 80
  g.adapter = :mongrel
end

It seems to be quite common to put this configuration into separate files so you can just require it on demand. There are other, slightly stronger way to set options, which is either using flags on the ramaze executable, or like this:

Ramaze.start :port => 80, :adapter => :mongrel

We haven't started Ramaze directly as of yet, but this allows you to ignore the ramaze executable and just run your application by

ruby start.rb

Next → Eleventh Step, Refactor with AspectHelper Ninth Step, Prettify ← Prev

 
Back to top
tutorials/todolist-10.txt · Last modified: 2008/01/31 04:51 by reacher