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.
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.
well, you can write HTML like a string, then have the output be an HTML
file. So,
This is really a question for the rails-talk list, but since I am
right now in rails...
I would create a rails application and a default controller and index
action. Then you can just write Ruby inside a <% %> pair in the
index.rhtml file.
I am sure you'll get a dozen responses about how to set it up simpler,
but that's the way I know you can get it to work from where you are.
I haven't played with Ruby and web outside of frameworks (Rails,
Camping, etc.), but you can use Apache with mod_ruby I think. Your
files will probably have to take on the eruby syntax of <% %>
encapsulating code tags, which would be similar to other interactive
web code (ala CodeFusion and others).
As far as I can tell, Mongrel knows how to feed a web server( like
Apache), but is not necessarily a complete web server itself.
Somebody correct me if I'm wrong, because I can't seem to find any
straight example of somebody just using Mongrel with Ruby by
themselves to serve pages!
thx,
Todd
···
On 11/6/07, rgossen <rgossen@gmail.com> 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
···
On Nov 6, 7:51 pm, rgossen <rgos...@gmail.com> 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.
Wow, this looks perfect. I was not familiar with haml, but after
looking at the tutorial, it looks like a great alternative to rhtml
for templating. Thanks so much for the tip.
···
On Nov 6, 8:14 pm, Nathan Grant <grant.nat...@gmail.com> wrote:
You might want to give heel a try, that's pretty much what it is, mongrel with
some mime-type sugar and nice directory listings.
% sudo gem install heel
% heel
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** heel running at http://127.0.0.1:4331 with document root /home/jeremy/proj
** Use Ctrl-C to stop.
** Launching your browser...
127.0.0.1 - - [07/Nov/2007:00:58:17 MST] "GET / HTTP/1.1" 200 46615
127.0.0.1 - - [07/Nov/2007:00:58:17 MST] "GET /icons/folder.png HTTP/1.1" 200 537
127.0.0.1 - - [07/Nov/2007:00:58:17 MST] "GET /icons/application.png HTTP/1.1" 200 464
enjoy,
-jeremy
···
On Wed, Nov 07, 2007 at 11:53:37AM +0900, Todd Benson wrote:
As far as I can tell, Mongrel knows how to feed a web server( like
Apache), but is not necessarily a complete web server itself.
Somebody correct me if I'm wrong, because I can't seem to find any
straight example of somebody just using Mongrel with Ruby by
themselves to serve pages!