From: John Feezell
Date: 2002-12-08T23:41:56+09:00
Subject: Re: eRuby (making it work - take 2)
Also, be sure to chmod on any rb or rbx files to make them
executable, i.e., mod 755
12/8/2002 8:09:09 AM, John Feezell wrote:
>After much time and numereous attempts, I did the following to get both
>Ruby and eRuby working for me.
>
>What follows assumes telnet access and a directory (cgi-bin for me) that
>is recognized by the system as an active cgi script directory.
>
>Start description ==============================
>1. installed Ruby using the -prefix=/my/path/to/ruby directory option
> If you need to, use ./configure --help to review options.
>
>2. installed eRuby
> If necessary, change the shebang #! line in configure.rb
> to point to the location of ruby, i.e.,
> #!/my/path/to/ruby
>
>3. created a .htaccess file in my "webdocuments" directory that
contained
>
>AddHandler cgi-script rb rbx
>
>AddHandler application/x-httpd-eruby .rhtml
>Action application/x-httpd-eruby /cgi-bin/eruby
>
>4. moved eRuby to my cgi-bin directory
>
>5. created GetEnv.rhtml containing:
>
>
>
>eruby example
>
>
>Enumeration
>
><%(1..10).each do|i|%>
>- number <%=i%>
><%end%>
>
>Environment variables
>
><%ENV.keys.sort.each do |key|%>
>
>| <%=key%> | <%=ENV[key]%> |
>
><%end%>
>
>
>
>
>6. created testRuby.rbx containing:
>#!/my/path/to/ruby
># This is a working ruby script running ruby script with
># extension .rb or .rbx
># If the key for ENV does not exist, then ruby returns nil.
># It requires the following modification to .htaccess in www
># AddHandler cgi-script rb rbx
>#
>
>require 'date'
>print "Content-type: text/html\n\n"
>d = Date.new(2000, 3, 31)
>print $:,'
'
>print ENV['RUBYPATH'],''
>print [d.year, d.yday, d.wday]
>print "this is a test.", ENV['PATH'], "prefix= ",ENV['prefix'],"
"
> names = ["john", "mary", "", 4]
> data = [1, 2, 3, 4]
> data.each do |i |
> print i, " ", names[i-1],"
"
> end
>print "Environment variables
"
>ENV.keys.sort.each do |key|
>print "| ",key," | ", ENV[key], " | "
>print "
"
>end
>print "
"
>
>7. Ran GetEnv.rhtml and testRuby.rbx
>
>8. They worked.
> WOW! EXCITEMENT!
> PHYSICAL EXPRESSIONS OF JOY!
> GREAT SENSE OF SATISFACTION! YES! WELL DONE!
>
>9. Hope you have the same result -- a sense of accomplishment
> and the joy of working with Ruby and eRuby.
>End description =============================
>
>
>12/7/2002 8:14:51 PM, Daniel Carrera wrote:
>
>>Hello,
>>
>>I want to try out eRuby. I am only a regular user, so I can't install
>>mod_ruby and I can't mess with Apache.
>>
>>However, I have enough space in my home directory to install eRuby.
>>
>>Can anyone tell me how I can use eRuby with what I have?
>>
>>One thought is to make a cgi program which simply calls eRuby and then
>>outputs what ever eRuby returns. This solution is a bit ugly though.
>>Plus, I'd have trouble if I ever want the eRuby program to receive CGI
>>parameters.
>>
>>Thanks for the help.
>>
>>Daniel Carrera
>>Graduate Teaching Assisant. Math Dept.
>>University of Maryland. (301) 405-5137
>>
>>
>>
>>
>>
>
>
>
>
>
>