B
Belorion
I am trying to get a basic Webrick server running to serve up .rhtml
files on a WinXP machine. I saw that you need to install erb to get
this to work (BTW, the erb link on the Webrick site is broken), so I
installed erb 2.0.4.
I startup a Webrick server using:
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new( ort=> 2000 )
## mount subdirectories
s.mount("/~test",
HTTPServlet::FileHandler, "c:\\documents and
settings\\user\\desktop\\test",
true) #<= allow to show directory index.
trap("INT"){ s.shutdown }
s.start
Serving up html works fine. However, serving up .rhtml does not work.
If I visit my test.rhtml, whose contents are:
<html><head></head><body>
testing, 1234
<%
10.times{ |i| puts i }
%>
</body></html>
All I get as output on my browser is "testing, 1234", whose source looks like
<html><head></head><body>
testing, 1234
</body></html>
At the command prompt, if I ruby "erb test.rhtml" I get:
0
1
2
3
4
5
6
7
8
9
<html>
<head>
</head>
<body>
testing, 1234
</body>
</html>
Which is obviously incorrect. What am I doing wrong here? I am using
ruby 1.8.2 (2004-07-29), and erb 2.0.4.
files on a WinXP machine. I saw that you need to install erb to get
this to work (BTW, the erb link on the Webrick site is broken), so I
installed erb 2.0.4.
I startup a Webrick server using:
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new( ort=> 2000 )
## mount subdirectories
s.mount("/~test",
HTTPServlet::FileHandler, "c:\\documents and
settings\\user\\desktop\\test",
true) #<= allow to show directory index.
trap("INT"){ s.shutdown }
s.start
Serving up html works fine. However, serving up .rhtml does not work.
If I visit my test.rhtml, whose contents are:
<html><head></head><body>
testing, 1234
<%
10.times{ |i| puts i }
%>
</body></html>
All I get as output on my browser is "testing, 1234", whose source looks like
<html><head></head><body>
testing, 1234
</body></html>
At the command prompt, if I ruby "erb test.rhtml" I get:
0
1
2
3
4
5
6
7
8
9
<html>
<head>
</head>
<body>
testing, 1234
</body>
</html>
Which is obviously incorrect. What am I doing wrong here? I am using
ruby 1.8.2 (2004-07-29), and erb 2.0.4.