Web development w/ ruby

Hi guys,

I need to make some simple web-pages at work for internal use
(changing svn password, modifying postfix email-aliases, etc). I’d
like to use ruby for this. I haven’t really done anything w/
web-development in many years, and back then i was using php. I know
that ruby on rails is the hottest thing ever right now, but it doesn’t
seem like i should need database-centric stuff like that for the
simple web-apps i need to develop. I found mod-ruby and have set it
up, but i’m not sure how to best use it now. Is there any
documentation avaliable? do i just use puts to output html streams,
or is that streamlined for me somehow? How do i ask for input, etc.?

Thanks,
Cameron M.

Cam wrote:

documentation avaliable? do i just use puts to output html streams,
or is that streamlined for me somehow? How do i ask for input, etc.?

Thanks,
Cameron M.

http://ruby-doc.org/core/classes/CGI.html

The CGI class with the HTML extensions will take care of all the HTML
output. For example:

require ‘cgi’

cgi = Cgi.new(‘html4’)

cgi.out {

cgi.html {

         cgi.body {

                        "Hello!"
         }
}

}

It has functions for nearly all HTML tags/forms/session/cookie stuff.

-Justin

gee don’t know how i never noticed that before… thanks!

Cameron M.

On 11/18/05, Cam [email protected] wrote:

documentation avaliable? do i just use puts to output html streams,
or is that streamlined for me somehow? How do i ask for input, etc.?

I’d point out that RoR does not need a DB. You can make your own
Models, or just put all your logic inside controllers. I’ve done that
for a couple of one-off projects. Works fine.

Ed

On 11/18/05, Cam [email protected] wrote:

documentation avaliable? do i just use puts to output html streams,
or is that streamlined for me somehow? How do i ask for input, etc.?

Brian Wisti has a simple page template tool that might work for you:
http://coolnamehere.com/products/pagetemplate/

Hi,

On 11/18/05, Ed Howland [email protected] wrote:

I’d point out that RoR does not need a DB. You can make your own
Models, or just put all your logic inside controllers. I’ve done that
for a couple of one-off projects. Works fine.

cool, i haven’t paid a whole lot of attention to rails (like i had
said i hadn’t been doing any sort of web-development before), but i
was under the impression that it was just for stream-lining
webapps/database/lard. I’ll have to give it another look,

Cam

“James B.” [email protected] wrote in message

I’ve found Nitro much simpler to work with than Rails in many cases,
particularly when starting off with no database and then, if needed,
easing into the use of one. It’s very natural.

That sounds like a big plus (over Rails). How does one go about doing
this?
And do the various relational macros carry over pretty well?

Cam wrote:

said i hadn’t been doing any sort of web-development before), but i
was under the impression that it was just for stream-lining
webapps/database/lard. I’ll have to give it another look,

You might also want to look at Nitro and IOWA

http://enigo.com/projects/iowa/tutorial/what_is_it.html

I’ve found Nitro much simpler to work with than Rails in many cases,
particularly when starting off with no database and then, if needed,
easing into the use of one. It’s very natural.

James

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - Ruby Code & Style: Writers wanted
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

Although eruby might familiar (and thus an ideal tool for these
particlar tasks), I’d recommend eventually learning the basics of RoR
as its MVC architecture encourages better style than PHP does most of
the time. It doesn’t need a database, and while ActiveRecord (its ORM)
is a big part of Rails, its use is by no means mandatory. And in time
you’ll probably need to use its other abilities (such as sending
emails or providing web services).

Jacob

Cam [email protected] wrote:

I need to make some simple web-pages at work for internal use
(changing svn password, modifying postfix email-aliases, etc).
I’d like to use ruby for this. I haven’t really done anything
w/ web-development in many years, and back then i was using
php. I know that ruby on rails is the hottest thing ever
right now, but it doesn’t seem like i should need
database-centric stuff like that for the simple web-apps
i need to develop. I found mod-ruby and have set it up, but
i’m not sure how to best use it now. Is there any
documentation avaliable?

do i just use puts to output html streams, or is that
streamlined for me somehow? How do i ask for input, etc.?

Coming from php, you might find eruby nice. It uses files of
extension .rhtml, and allows you to embed ruby code inside an
html page, a la php or asp.

Combining eruby for the template side, and the CGI module for
additional HTML generation and form processing, should be
a nice, simple solution to providing browser access to system
utilities.

HTH,
Tim H.

I’ve found Nitro much simpler to work with than Rails in many cases,
particularly when starting off with no database and then, if needed,
easing into the use of one. It’s very natural.

That sounds like a big plus (over Rails). How does one go about doing this?
And do the various relational macros carry over pretty well?

very easy:

$ gem install nitro
$ cd mydir
$ mkdir public
$ vi run.rb
include ‘nitro’
Nitro.run
$ cd public
$ vi index.xhtml
hello world
$ cd …
$ ruby run.rb

and browse localhost:9999

to make this dynamic:

$ vi public/index.xhtml
hello world, the time is #{Time.now}

and refresh your browser :wink:

From there, you can start adding pretty much everything, from ORM, to
ajax, to webservices, you name it. Nitro provides everything you need.

For more details check out www.nitrohq.com, or join the mailing list…

regards,
George.

cameron.matheson wrote:

Hi guys,

I need to make some simple web-pages at work for internal use
(changing svn password, modifying postfix email-aliases, etc). I’d
like to use ruby for this.

I too am unable to find any documentation or help for building wep apps
(outside of rails). I am confused between mod_ruby, cgi, fcgi,
ruby-web, ruby-fcgi etc. Is there a simple tutorial?

I did get a simple cgi program to run off apache (unmodified), but when
i added "require ‘cgi’ it threw a 500 internal error. I have installed
rails, but first wish to do some non-db stuff outside of it. Just
apache or lighttpd.

rahul benegal wrote:

(outside of rails). I am confused between mod_ruby, cgi, fcgi,
ruby-web, ruby-fcgi etc. Is there a simple tutorial?

Consider IOWA or Narf or Og/Nitro. Or their libraries.

http://enigo.com/projects/iowa/tutorial/what_is_it.html

http://www.narf-lib.org/

http://oxyliquit.de/tutorials


James B.

“Take eloquence and wring its neck.”

  • Paul Verlaine

On 6/7/06, Mat S. [email protected] wrote:

(outside of rails). I am confused between mod_ruby, cgi, fcgi,
working together to produce a lightweight web environment much like
PHP (where I came to Ruby from). Althought I understand mod_ruby
has some speed issues.
However, get, post, and cookies are still a bit of a headache. I’m
hoping to make some progress on that shortly.
-Mat

I’ve used Rails so much, that now I just install Rails, and use it
without a database. I really like the whole environment and since I
am used to it (testing, webrick while designing, etc.) it works really
well. Just a suggestion. Good luck.

On Jun 7, 2006, at 12:30 AM, rahul benegal wrote:

ruby-web, ruby-fcgi etc. Is there a simple tutorial?

I did get a simple cgi program to run off apache (unmodified), but
when
i added "require ‘cgi’ it threw a 500 internal error. I have installed
rails, but first wish to do some non-db stuff outside of it. Just
apache or lighttpd.

I’ve come up against the lack of tutorials for such a thing as well.
But recently I’ve made good progress getting mod_ruby and eRuby
working together to produce a lightweight web environment much like
PHP (where I came to Ruby from). Althought I understand mod_ruby
has some speed issues.
However, get, post, and cookies are still a bit of a headache. I’m
hoping to make some progress on that shortly.
-Mat

cameron.matheson wrote:

Hi,

On 11/18/05, Ed Howland [email protected] wrote:

I’d point out that RoR does not need a DB. You can make your own
Models, or just put all your logic inside controllers. I’ve done that
for a couple of one-off projects. Works fine.

cool, i haven’t paid a whole lot of attention to rails (like i had
said i hadn’t been doing any sort of web-development before), but i
was under the impression that it was just for stream-lining
webapps/database/lard. I’ll have to give it another look,

Alternatively, you could just go camping. Camping is fun. :slight_smile:

http://camping.rubyforge.org/files/README.html

That sounds like a terrific project, well worth pursuing.
And I am /delighted/ to hear that there are aspects of
Rails I can use without a database (thanks, Asenchi).

Thinking I had to install a database is one of the things
that has kept me from taking a look at Rails…

On Jun 7, 2006, at 9:51 AM, Asenchi wrote:

I too am unable to find any documentation or help for building wep

without a database. I really like the whole environment and since I
am used to it (testing, webrick while designing, etc.) it works really
well. Just a suggestion. Good luck.

I’ve considered this option as well and I kinda like it. My main
drive for creating a PHP-like Ruby web environment is evangelism, I
think. Lowering the barrier to entry so that (so long as it’s
installed on the server) all a user has to do to start coding is open
a .rhtml file. That and possibly pairing it with a PHP->Ruby
translation package to get my old apps working in Ruby (albeit, ugly
Ruby).

Hopefully I’m not grossing out anyone too much here, but I think
it’s worthwhile.
-Mat

Eric A. wrote:

That sounds like a terrific project, well worth pursuing.
And I am /delighted/ to hear that there are aspects of
Rails I can use without a database (thanks, Asenchi).

Thinking I had to install a database is one of the things
that has kept me from taking a look at Rails…

Even if you do find you need a database eventually, you should take a
look at sqlite (if you haven’t already). Drop dead simple, especially
with Rails’ migrations.


Alex

I’ve been shipping and supporting commercial applications in
Ruby-without-Rails for three years now. There are tutorials out there
for
getting eruby and mod_ruby to work with Apache. Also, if you read the
documentation for Ruby CGI modules and classes, that’s a big head start.
Performance can be a problem, but it’s vastly better than Rails at any
rate.
And some newer approaches are starting to emerge as well.