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 <JohnFeezell / 3wplace.com> 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:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
><html>
><head>
><title>eruby example</title>
></head>
><body>
><h1>Enumeration</h1>
><ul>
><%(1..10).each do|i|%>
><li>number <%=i%></li>
><%end%>
></ul>
><h1>Environment variables</h1>
><table>
><%ENV.keys.sort.each do |key|%>
><tr>
><th><%=key%></th><td><%=ENV[key]%></td>
></tr>
><%end%>
></table>
></body>
></html>
>
>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 $:,'</p>'
>print ENV['RUBYPATH'],'</br>'
>print [d.year, d.yday, d.wday]
>print "this is a test.", ENV['PATH'], "prefix= ",ENV['prefix'],"<br>"
>  names = ["john", "mary", "", 4]
>  data = [1, 2, 3, 4]
>       data.each do  |i |
>       print i, "    ", names[i-1],"<br>"
>       end
>print "<h1>Environment variables</h1><table>" 
>ENV.keys.sort.each do |key|
>print "<tr><th>",key,"</th><td>", ENV[key], "</td>"
>print "</tr>"
>end
>print "</table>"
>
>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 <dcarrera / math.umd.edu> 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
>>
>>
>>
>>
>>
>
>
>
>
>
>