super simple serving of ruby pages

J

Jonathan Denni

Thanks a lot. I didn't get it working. I put erb.cgi and a .htaccess in
/var/www/cgi-bin/ as directed in http://www.hiveminds.co.uk/node/3105
but I can't find out what kind of OS the server is using, and i cannot
create/edit files or directories in /bin or /usr/bin

at this point, it looks to me like i should give up trying to use ruby
on that server.

Thanks again for your help.
 
J

James Edward Gray II

http://jamesbritt.com/code/wb_erb.tgz

Fairly simple, few features, demos a few concepts.

Interesting. Thanks for sharing.

I'll try and pay you back at least some of the effort by addressing
one of your TODOs. From your code:

# Windows only. TODO: figure out
# how to do the same thing on Mac and 'nix boxen.
Thread.new {
# Wait a bit for the server to start, then launch a Web browser
# to show the default page
sleep( 5 )
warn `start http://127.0.0.1:#{PORT}`
}

On Mac OS X, replace the word "start" with "open" and it will work.

Hope that helps.

James Edward Gray II
 
K

khaines

I've an example of this that's ~100 lines of code, if you're interested.

Maps URLs to classes and templates and renders them, using erb and Webrick.

I'd like to see it, just because I might find it educational.

I've also been wondering if framework support for this sort of thing, but
very simple to setup, would be useful to people?

Something akin to this:

app.rb
-----
require 'iowa'

Iowa.run
-----


app.cnf
-----
socket:
hostname: foo.bar.com
port: 3000
application:
dispatcher:
class: StandardDispatcher
mapfile: mapfile.cnf
-----


mapfile.cnf:
-----
:map:
/index.html: Index
/form.html: Myform
/response.html: Myresponse
-----


If one had an index.rhtml, myform.rhtml, and myresponse.rhtml, they would
be mapped to classes Index, Myform, and Myresponse, and requests for the
urls above would go to the class in question and be rendered as an erb
template.

You'd run it with:

ruby app.rb -r webrick
or
ruby app.rb -r mongrel

No other code or config necessary to serve those rhtml files. Would
anyone use this ability (as I personally would not). Worth my time to
make the above work?



Kirk haines
 
D

David Vallner

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan said:
ahh, well, thats probably my problem. i'm using the cheapest server i
could find (canaca.com), which obviousely has no support for ruby. i was
hoping there was some shortcut way i could use ruby on my website
without having to change servers. is there some way to do that, or is it
totally hopeless?

Serve (part) of your website from your PC over which you have control?
If it's a personal website or to display some experiments, this should
be sufficient.

David Vallner
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFHmIwy6MhrS8astoRAg4fAJ91NJYACa7LhlQhq4XaCUfIDDM+1QCdHW+e
ux5wCukpPCM6L7pHYk95d0M=
=PhPZ
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top