From: dusty Date: 2007-11-07T12:00:13+09:00 Subject: Re: Write webpages in Ruby without Rails? - Newb Question On Nov 6, 7:51 pm, rgossen wrote: > I am a programming newb and I just bought the book "Software > Engineering for Internet Applications," and I need a server to go > through the labs. Unfortunately, the extent of my server experience > is using script/server in Rails. To do these labs, I need to write > webpages in Ruby without Rails (or any framework), but I am not sure > exactly how to go about it. > > I started to use the Apache 1.3 webserver that comes with os x and > attempted to install eruby. That doesn't seem to be working. I am > thinking there has to be an easier way. Is there a way for me to use > Mongrel or Webrick outside of Rails? I initially installed everything > using the Hivelogic instructions. Check out webrick. Here is a simple script that will do a directory listing on wherever you run it. Just open up your browser to port 2000. Now, to get it to actually output html content-types and all, will require some more work. But, perhaps this will get you started. #!/bin/env ruby require 'webrick' include WEBrick s = HTTPServer.new( :Port => 2000, :DocumentRoot => Dir::pwd ) trap("INT"){ s.shutdown } s.start