Forum: Ruby web development w/ ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ef48af8b07b976160c860ddec9aea55f?d=identicon&s=25 cameron.matheson (Guest)
on 2005-11-18 23:40
(Received via mailing list)
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 Matheson
F3b7109c91841c7106784d229418f5dd?d=identicon&s=25 collinsj (Guest)
on 2005-11-18 23:49
(Received via mailing list)
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 Matheson
>
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
Ef48af8b07b976160c860ddec9aea55f?d=identicon&s=25 cameron.matheson (Guest)
on 2005-11-18 23:55
(Received via mailing list)
gee don't know how i never noticed that before... thanks!

Cameron Matheson
822a498b26a2cb7d1f0f2e7e37ce61b2?d=identicon&s=25 ed.howland (Guest)
on 2005-11-19 00:34
(Received via mailing list)
On 11/18/05, Cam <cameron.matheson@gmail.com> 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
Ff63c03fd68754adbadd2c6314646bef?d=identicon&s=25 Bill Guindon (agorilla)
on 2005-11-19 01:44
(Received via mailing list)
On 11/18/05, Cam <cameron.matheson@gmail.com> 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/
Ef48af8b07b976160c860ddec9aea55f?d=identicon&s=25 cameron.matheson (Guest)
on 2005-11-19 01:44
(Received via mailing list)
Hi,

On 11/18/05, Ed Howland <ed.howland@gmail.com> 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
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 james_b (Guest)
on 2005-11-19 02:35
(Received via mailing list)
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://www.nitrohq.com

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
http://www.artima.com/rubycs/ - 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
Fe57662c550fb3cce44c398ddf2dd706?d=identicon&s=25 itsme213 (Guest)
on 2005-11-19 03:47
(Received via mailing list)
"James Britt" <james_b@neurogami.com> 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?
F4b217bc917acf97e7c27c404cea35ce?d=identicon&s=25 penryu (Guest)
on 2005-11-19 11:29
(Received via mailing list)
Cam <cameron.matheson@gmail.com> 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 Hammerquist
Dfc2a545a0c4f542d69f89a782714e8e?d=identicon&s=25 jqshenker (Guest)
on 2005-11-19 12:02
(Received via mailing list)
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
7a4e995e378ef66de0ceaea5e1381ee1?d=identicon&s=25 george.moschovitis (Guest)
on 2005-11-19 13:36
(Received via mailing list)
> > 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
   <b>hello world</b>
$ cd ..
$ ruby run.rb

and browse localhost:9999

to make this dynamic:

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

and refresh your browser ;-)

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.
D73739ee3bf95354d768ade55a014a58?d=identicon&s=25 Rahul Benegal (rahulbenegal)
on 2006-06-07 06:29
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. <b>Is there a simple tutorial?</b>

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.
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-06-07 07:55
(Received via mailing list)
rahul benegal wrote:
> (*outside* of rails). I am confused between mod_ruby, cgi, fcgi,
> ruby-web, ruby-fcgi etc. <b>Is there a simple tutorial?</b>

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 Britt

"Take eloquence and wring its neck."
  - Paul Verlaine
Fc784eadb3b54531fdc3d2053db6f83f?d=identicon&s=25 Mat Schaffer (Guest)
on 2006-06-07 15:50
(Received via mailing list)
On Jun 7, 2006, at 12:30 AM, rahul benegal wrote:
> ruby-web, ruby-fcgi etc. <b>Is there a simple tutorial?</b>
>
> 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
B22ecff852950d6b13b5a655229489ca?d=identicon&s=25 Asenchi (Guest)
on 2006-06-07 15:53
(Received via mailing list)
On 6/7/06, Mat Schaffer <schapht@gmail.com> 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.
Fc784eadb3b54531fdc3d2053db6f83f?d=identicon&s=25 Mat Schaffer (Guest)
on 2006-06-07 16:01
(Received via mailing list)
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
A6aaaaf5d124132f358752c7d72d4b44?d=identicon&s=25 Guest (Guest)
on 2006-06-09 01:53
cameron.matheson wrote:
> Hi,
>
> On 11/18/05, Ed Howland <ed.howland@gmail.com> 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. :)

http://camping.rubyforge.org/files/README.html
36194a022cb2afb981bfdf720fc67d82?d=identicon&s=25 Eric Armstrong (Guest)
on 2006-06-12 23:01
(Received via mailing list)
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...
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (regularfry)
on 2006-06-12 23:11
(Received via mailing list)
Eric Armstrong 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
E29eaefee1709918198c8a4f55c42667?d=identicon&s=25 anne001 (Guest)
on 2006-06-15 16:58
(Received via mailing list)
> 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).

How do you make progress if there is no documentation? What is the key
to your progress?
481b8eedcc884289756246e12d1869c1?d=identicon&s=25 Francis Cianfrocca (Guest)
on 2006-06-15 17:39
(Received via mailing list)
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.
E29eaefee1709918198c8a4f55c42667?d=identicon&s=25 anne001 (Guest)
on 2006-06-15 20:26
(Received via mailing list)
It was very hard to install eruby, I had to install erb, and then I did
the same for eruby. I was not able to install mod_ruby on my tiger the
first time. and I can't install it this time either.
./configure.rb --with-apxs=/usr/sbin/apxs
works on tiger,
but the make gives an error.

Where is this documentation on ruby CGI modules and classes?
481b8eedcc884289756246e12d1869c1?d=identicon&s=25 Francis Cianfrocca (Guest)
on 2006-06-15 20:39
(Received via mailing list)
ruby CGI docs are in the rdocs.
Might be easiest for you to build apache from source. I'd do it in a
non-privileged user directory (./configure --prefix=/Users/you/some_dir)
while you're figuring it out, and make sure you throw the switches to
give
you an so-enabled build with apxs.
A2b2f4ee23989dc68529baef9cbddcd6?d=identicon&s=25 Julian 'Julik' Tarkhanov (Guest)
on 2006-06-16 00:23
(Received via mailing list)
On 15-jun-2006, at 17:38, Francis Cianfrocca wrote:

> 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.

I am actually eager to see something emerge that will be the next
twist to Rails (adopting it's developments
and findings but then with proper components, interresting sesson
persistence etc.)

I am sure it's possible to get some mileage out of Rails components
by themselves as well.
This topic is locked and can not be replied to.