[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby without rails?

Shashank Agarwal

7/8/2008 4:24:00 PM

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
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
HTMLEND
--
Posted via http://www.ruby-....

10 Answers

Tim Pease

7/8/2008 4:32:00 PM

0

On Jul 8, 2008, at 10:23 AM, Shashank Agarwal 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. 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
> <html>
> <head>
> <title>Hello World</title>
> </head>
> <body>
> <h1>Hello World</h1>
> </body>
> </html>
> HTMLEND

If your intention is to generate static pages then I would recommend
webby <http://webby.rubyfor... 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


Martin DeMello

7/8/2008 4:34:00 PM

0

On Tue, Jul 8, 2008 at 9:23 AM, Shashank Agarwal <shashank_hi@yahoo.com> 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/we... -
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

Vassilis Rizopoulos

7/8/2008 4:39:00 PM

0

Shashank Agarwal 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. 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
> <html>
> <head>
> <title>Hello World</title>
> </head>
> <body>
> <h1>Hello World</h1>
> </body>
> </html>
> 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.-

--
http://www.braveworl...


John Joyce

7/8/2008 4:49:00 PM

0


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

> Shashank Agarwal 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. 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
>> <html>
>> <head>
>> <title>Hello World</title>
>> </head>
>> <body>
>> <h1>Hello World</h1>
>> </body>
>> </html>
>> 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.-
>
> --
> http://www.braveworl...
>
>
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.


James Britt

7/8/2008 5:33:00 PM

0

Tim Pease wrote:

>
> If your intention is to generate static pages then I would recommend
> webby <http://webby.rubyfor... 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 Britt

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

James Britt

7/8/2008 5:37:00 PM

0

John Joyce 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 Britt

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

Shashank Agarwal

7/8/2008 7:02:00 PM

0

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)). :)
--
Posted via http://www.ruby-....

Shashank Agarwal

7/8/2008 7:03:00 PM

0

Shashank Agarwal wrote:
>I looked at Ramaze's screenshots

Whoops, I meant screencasts
--
Posted via http://www.ruby-....

Jeremy McAnally

7/8/2008 7:29:00 PM

0

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 Agarwal <shashank_hi@yahoo.com> 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)). :)
> --
> Posted via http://www.ruby-....
>
>



--
http://jeremymca...
http:...

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

Or, my blogs:
http://mrneig...
http://rubyinpr...

James Britt

7/8/2008 11:00:00 PM

0

Shashank Agarwal 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)). :)


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





--
James Britt

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