Ruby without rails?

I’m trying to develop a small website, and was planning to use Ruby
alone (I don’t know much Rails, and wasn’t planning on learning it for
the project). Is there a way to run .rb files under a webserver. I’m
developing the site on Windows and will eventually be running it on a
unix platform with Apache. I tried using instantrails, but that didn’t
help. I even installed the fast-cgi module in Apache. When I run the .rb
file, I simple see the code. This is the code I’m trying to run -

print <<-HTMLEND

Hello World

Hello World

HTMLEND

On Jul 8, 2008, at 10:23 AM, Shashank A. wrote:

Hello World

Hello World

HTMLEND

If your intention is to generate static pages then I would recommend
webby http://webby.rubyforge.org or one of the other static website
generators written in ruby (nanoc, webgen, rassmalog).

If you are going to connect to a database and serve dynamic content,
then you could look into some of the rails alternatives: merb, ramaze,
iowa, camping.

Blessings,
TwP

On Tue, Jul 8, 2008 at 9:23 AM, Shashank A. [email protected]
wrote:

I’m trying to develop a small website, and was planning to use Ruby
alone (I don’t know much Rails, and wasn’t planning on learning it for
the project). Is there a way to run .rb files under a webserver.

The simplest thing to do is use one of the (many excellent)
microframeworks out there. (I can personally recommend ramaze, and
sinatra looks excellent too). But to answer your original question,
take a look at http://coolnamehere.com/geekery/ruby/web/cgi.html -
your script needs to be executable, registered with your webserver as
a cgi handler, and emit the proper headers. As your app gets more
complicated, you’ll probably need to handle CGI forms, redirects, etc,
all of which is a nuisance, which is why I recommend using a
microframework.

martin

Shashank A. wrote:

<head>
  <title>Hello World</title>
</head>
<body>
  <h1>Hello World</h1>
</body>
HTMLEND

There are quite a few ways to do web apps without rails.
Check out Camping, Ramaze or Merb, they are all alternatives to Rails as
in they are WebApp frameworks.
Now, development would be done with the built in ruby webservers
(WebRick, Mongrel, Thin) and deployment is a much documented subject
(i.e. Ramaze in it’s site has a whole bunch of deployment possibilities,
including Apache).
I would definitely take the time to learn any one of them, as otherwise
you will be reinventing the wheel for a lot of what you are going to
do.
Cheers,
V.-

On Jul 8, 2008, at 11:39 AM, Vassilis R. wrote:

file, I simple see the code. This is the code I’m trying to run -
HTMLEND
are going to do.
Cheers,
V.-


http://www.braveworld.net/riva

What the OP is probably looking for is something more like the way PHP
is inlined.
At the very least, you will want to look at the Ruby CGI library (not
well documented) and some form of eRuby, ERB or Erubis or something
similar.

Tim P. wrote:

If your intention is to generate static pages then I would recommend
webby http://webby.rubyforge.org or one of the other static website
generators written in ruby (nanoc, webgen, rassmalog).

I second that. Webby is quite cool.

If you are going to connect to a database and serve dynamic content,
then you could look into some of the rails alternatives: merb, ramaze,
iowa, camping.

Also quite true. There are several Ruby Web frameworks that, like Ruby,
are light yet powerful; migrating from a Webby site to a Ramaze site
(should you decide you need a DB back-end) would be trivial.


James B.

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff

John J. wrote:

What the OP is probably looking for is something more like the way PHP
is inlined.
At the very least, you will want to look at the Ruby CGI library (not
well documented) and some form of eRuby, ERB or Erubis or something
similar.

Or Ramaze or (I think) Merb, which easily allow you do create 1-file
PHP-sort-of-but-thankfully-not-really Web apps.


James B.

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff

Thank you all for the wonderful suggestions. :). I’ve started looking
into Ramaze, and it definitely seems more manageable than Rails. I need
to connect to a database, so Webby went out, while I couldn’t find a
good tutorial for Merb. I looked at Ramaze’s screenshots and it
certainly seemed something that I could handle. But thank you once
again. I was very lost before this (and even thought of using PHP once
(phew)). :slight_smile:

Shashank A. wrote:

I looked at Ramaze’s screenshots

Whoops, I meant screencasts

Ramaze is an excellent choice. You could also check out my little
framework called Vintage that’s very PHP-esque except in Ruby. I
don’t have database stuff “in the framework” but you can set it up and
still use it inside of it.

–Jeremy

On Tue, Jul 8, 2008 at 2:02 PM, Shashank A. [email protected]
wrote:


http://jeremymcanally.com/
http://entp.com

Read my books:
Ruby in Practice (http://manning.com/mcanally/)
My free Ruby e-book (http://humblelittlerubybook.com/)

Or, my blogs:
http://mrneighborly.com
http://rubyinpractice.com

Shashank A. wrote:

Thank you all for the wonderful suggestions. :). I’ve started looking
into Ramaze, and it definitely seems more manageable than Rails. I need
to connect to a database, so Webby went out, while I couldn’t find a
good tutorial for Merb. I looked at Ramaze’s screenshots and it
certainly seemed something that I could handle. But thank you once
again. I was very lost before this (and even thought of using PHP once
(phew)). :slight_smile:

Drop by the #ramaze IRC channel on freenode; it’s usually quite active
and folks are quick to help.


James B.

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs