eRuby: A tutorial on using Ruby on the web

A group (three) of us wanted to learn Ruby but we decided that Rails was no
the way to do it. We could not find anything on getting started with using
web oriented Ruby we took a bit of time to do a tutorial. It covers how to
set up a PC and a shared host for eRuby scripting.

It is windows oriented because that is the common ground for us all . (two
of us are windows and lotus network admins) We tried to make it newbie
friendly. Hopefully it will spark some more interest in Ruby from others
coming from PHP and other scripting languages.

http://www.hiveminds.co.uk/node/3094

Nice work! I'm always happy to see more tutorials covering this angle. I like the use of CGI to get the parameters, but I'd really like to see more documentation for the Apache:: set of classes, since they're already included when you hit the .rhml (IIRC).

Either way, thanks!
-Mat

···

On Jul 26, 2006, at 9:45 AM, tesla wrote:

A group (three) of us wanted to learn Ruby but we decided that Rails was no
the way to do it. We could not find anything on getting started with using
web oriented Ruby we took a bit of time to do a tutorial. It covers how to
set up a PC and a shared host for eRuby scripting.

It is windows oriented because that is the common ground for us all . (two
of us are windows and lotus network admins) We tried to make it newbie
friendly. Hopefully it will spark some more interest in Ruby from others
coming from PHP and other scripting languages.

http://www.hiveminds.co.uk/node/3094

http://www.hiveminds.co.uk/node/3094

A bit of FUD in there about Rails:

Rails also has many drawbacks in that it removes almost all of the portability
of Ruby"

How so? Ruby runs everywhere so Rails pretty much can too.

Deploying a Rails application is complicated, time consuming task and just not
something that you will want to do on a repetative basis

Here is your deployment tool:

http://wiki.rubyonrails.com/rails/pages/Capistrano

Rails also is a lot of work if you just want to do a single webpage application
that contains everything.

Everything like what? I have found everything I need up to now. I've
even ripped out portions of my own code when I would find there is a
Ruby gem that provides what I need.

Web hosting companies are also a large factor in using Rails. To do Rails
properly you need to have ssh knowledge and be prepared to do some
command line manipulation of files. The needs of Rails makes a shared
hosting environment difficult to set up and administrate.

There are many hosting companies that are embracing Rails with open
arms. Here are your current options:

http://wiki.rubyonrails.com/rails/pages/RailsWebHosts

I use OCSSolutions.com. They have a nice setup, very smart folks
working there and very responsive service.

As far as using SSH, I'm not sure why you wouldn't want that. Clear
text FTP passwords are bad and most GUI FTP clients support SFTP at
this point.

One of the biggest Rails drawback for me and the reason that I decided to go with
eRuby is the that Rails was taking up all my time with Rails problems and
troubleshooting. I was learning a lot about using Rails but not much of the
Ruby programming language.

You might want to pick up a copy of Ruby for Rails:

To effectively use a framework you should probably know the language
it's built with, that's gonna be true for any web framework, not just
Rails.

···

On 7/26/06, tesla <tesla.nicoli@gmail.com> wrote:

--
Greg Donald
http://destiney.com/

Yes, I saw mentions of this Apache::Erubyrun in the lists but I did not find
the class in any of the documentation. We want to use the simpliest means of
scripting because we later will be trying to teach this to highschool
students. Is the Apache class better but just not documented? translated?

-Tesla

···

On 7/26/06, Mat Schaffer <schapht@gmail.com> wrote:

On Jul 26, 2006, at 9:45 AM, tesla wrote:

> A group (three) of us wanted to learn Ruby but we decided that
> Rails was no
> the way to do it. We could not find anything on getting started
> with using
> web oriented Ruby we took a bit of time to do a tutorial. It covers
> how to
> set up a PC and a shared host for eRuby scripting.
>
> It is windows oriented because that is the common ground for us
> all . (two
> of us are windows and lotus network admins) We tried to make it
> newbie
> friendly. Hopefully it will spark some more interest in Ruby from
> others
> coming from PHP and other scripting languages.
>
> http://www.hiveminds.co.uk/node/3094

Nice work! I'm always happy to see more tutorials covering this
angle. I like the use of CGI to get the parameters, but I'd really
like to see more documentation for the Apache:: set of classes, since
they're already included when you hit the .rhml (IIRC).

Either way, thanks!
-Mat

Here are the facts:

All there of us have had Programmming Ruby, Agile Ruby on Rails books for a
few weeks or more. After trying to create simple applications we dropped a
proposal to do an intranet in Rails and created it in WebGUI instead. I hate
Perl but Rails was taking too much time.

> http://www.hiveminds.co.uk/node/3094

A bit of FUD in there about Rails:

> Rails also has many drawbacks in that it removes almost all of the
portability
> of Ruby"

How so? Ruby runs everywhere so Rails pretty much can too.

Rails on my PC has differences from what is in my web host and so the
application will not run without me tweaking it. We deployed a test app to
Dreamhost, Bluehost and HostPC. Of the three Bluehost worked without
problems but still required some changes. The other instances just did not
run.

Deploying a Rails application is complicated, time consuming task and just
not
> something that you will want to do on a repetative basis

Here is your deployment tool:

http://wiki.rubyonrails.com/rails/pages/Capistrano

We used switchtower.

Rails also is a lot of work if you just want to do a single webpage
application
> that contains everything.

Everything like what? I have found everything I need up to now. I've
even ripped out portions of my own code when I would find there is a
Ruby gem that provides what I need.

A simple single page guestbook is what we are testing. Rails was just too
much for something so simple.

Web hosting companies are also a large factor in using Rails. To do Rails
> properly you need to have ssh knowledge and be prepared to do some
> command line manipulation of files. The needs of Rails makes a shared
> hosting environment difficult to set up and administrate.

There are many hosting companies that are embracing Rails with open
arms. Here are your current options:

http://wiki.rubyonrails.com/rails/pages/RailsWebHosts

I use OCSSolutions.com. They have a nice setup, very smart folks
working there and very responsive service.

The problem is that they all hosters seem to have unseen differences that
clog the process. Each of the three we tried seem to have different versions
and packages of Ruby running. Apache was a problem. We run Apache 2 which
did not seem to be a problem a first but when things stopped working
everyone started pointing to the Apache servers first. Rails was just not
generic enough for us.

As far as using SSH, I'm not sure why you wouldn't want that. Clear

text FTP passwords are bad and most GUI FTP clients support SFTP at
this point.

SSH seemed to be needed to troubleshoot. Each time we contacted a support
desk we were asked to telnet into the server and do configuration changes.

One of the biggest Rails drawback for me and the reason that I decided to
go with
> eRuby is the that Rails was taking up all my time with Rails problems
and
> troubleshooting. I was learning a lot about using Rails but not much of
the
> Ruby programming language.

You might want to pick up a copy of Ruby for Rails:
http://www.manning.com/black/

To effectively use a framework you should probably know the language
it's built with, that's gonna be true for any web framework, not just
Rails.

Exactly our point. Since the end result should be a Ruby teaching
situation we found that Rails got in the way. Also students would need
two books (budgets you know) rather than one :wink:

Also I truly dislike that acronym FUD. It is thrown about too often when
people are giving their experiences, outlook and opinion. None or us fear
Rails, are uncertain about its purpose nor doubt that its capabilities. We
just decided based on our own conferencing and experimentation not to go
with Rails this time and we gave our reasons why.

···

On 7/26/06, Greg Donald <gdonald@gmail.com> wrote:

On 7/26/06, tesla <tesla.nicoli@gmail.com> wrote:

--

Greg Donald
http://destiney.com/

I would love to see a tutorial on using Ruby on the web, rails free.

This tutorial is more about installation. As far as showing what Ruby
can do, it is as limited as all the old book which touched on the
subject. Show how to generate an html page, show how to post with CGI.
Stop.

I agree, this are all necessary steps, and it takes a lot of time to
get there, I know, I went that route too, Rails is too much of a
muchness...

But I wish there was a tutorial which went beyond, is cgi limited to
forms, is eruby limited to creating an html page?

But isn't is also possible that someone doesn't want to learn a framework? I'm not one for FUD and I love rails, but I see no reason there shouldn't be tutorials for doing it both ways.
-Mat

···

On Jul 26, 2006, at 11:16 AM, Greg Donald wrote:

To effectively use a framework you should probably know the language
it's built with, that's gonna be true for any web framework, not just
Rails.

The CGI class seemed to have everything needed to build but someone
mentioned an Apache:: class that seems to be undocumented. I have googled
around and found nothing more than mentions of this class.

http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/index.html

I will see if there will be more tutorials. This last one was an organic
occurance. I don't know if Carl is ready to give up writing about PHP
completely since he has just been employed as a fulltime PHP developer come
August.

···

On 7/26/06, anne001 <anne@wjh.harvard.edu> wrote:

I would love to see a tutorial on using Ruby on the web, rails free.

This tutorial is more about installation. As far as showing what Ruby
can do, it is as limited as all the old book which touched on the
subject. Show how to generate an html page, show how to post with CGI.
Stop.

I agree, this are all necessary steps, and it takes a lot of time to
get there, I know, I went that route too, Rails is too much of a
muchness...

But I wish there was a tutorial which went beyond, is cgi limited to
forms, is eruby limited to creating an html page?

Rails on my PC has differences from what is in my web host and so the
application will not run without me tweaking it. We deployed a test app to
Dreamhost, Bluehost and HostPC. Of the three Bluehost worked without
problems but still required some changes. The other instances just did not
run.

That's why there are different environment files in
config/environments. You can customize your setup based on the
environment.

The problem is that they all hosters seem to have unseen differences that
clog the process. Each of the three we tried seem to have different versions
and packages of Ruby running.

That's how it is everywhere. One of my client's setups will be
running PHP 4.4.x while another will be running PHP 5, one has MySQL
3.23 and another has 5 already. As a developer I assume it's up to me
to write code for the production environment. I then try to duplicate
that exact production environment locally if possible. With apps like
VMWare and Parallels and FreeBSD jails, it is quite simple.

Apache was a problem. We run Apache 2 which
did not seem to be a problem a first but when things stopped working
everyone started pointing to the Apache servers first.

My setup uses Apache 2 proxying requests to a Lighttpd instance. I
never have to mess with Apache when troubleshooting my Rails apps, I
just do the fix and restart my Lighttpd instance, since it runs as my
user, not Apache's user.

Rails was just not
generic enough for us.

I'm sure it can handle a 15 minute guestbook app. :slight_smile:

SSH seemed to be needed to troubleshoot. Each time we contacted a support
desk we were asked to telnet into the server and do configuration changes.

Interesting that you would choose a host that still allows telnet,
very insecure.

Exactly our point. Since the end result should be a Ruby teaching
situation we found that Rails got in the way. Also students would need
two books (budgets you know) rather than one :wink:

Well.. when the docs aren't all that great and the Rails developers
mostly write books instead of improving the online docs, what's a
developer to do? Buy the books. *shrug*

I feal your pain on this one. I have 8+ years doing PHP and MySQL
apps and have never had to buy a single book. Meanwhile I have
slightly more than a year doing Rails apps and have 5 Ruby/Rails
related books, not counting ebooks.

Also I truly dislike that acronym FUD. It is thrown about too often when
people are giving their experiences, outlook and opinion. None or us fear
Rails, are uncertain about its purpose nor doubt that its capabilities. We
just decided based on our own conferencing and experimentation not to go
with Rails this time and we gave our reasons why.

Ruby and Rails and command lines and sysadmin tasks aren't for
everyone. Good luck.

···

On 7/26/06, tesla <tesla.nicoli@gmail.com> wrote:

--
Greg Donald
http://destiney.com/

<...>

> Here is your deployment tool:
>
> http://wiki.rubyonrails.com/rails/pages/Capistrano

We used switchtower.

<...>

Swichtower was renamed to Capistrano.

Regards,
Rimantas

···

--
http://rimantas.com/

I don't know if it's better or worse, it just doesn't require typing:

require 'cgi'
cgi = CGI.new

into every script cause it's already available. The mod_ruby list-folk have been fairly knowledgeable about the Apache module in the past when I asked a few questions. But on the whole it's been pretty rough going learning how to use that library.
-Mat

···

On Jul 26, 2006, at 11:07 AM, tesla wrote:

Yes, I saw mentions of this Apache::Erubyrun in the lists but I did not find
the class in any of the documentation. We want to use the simpliest means of
scripting because we later will be trying to teach this to highschool
students. Is the Apache class better but just not documented? translated?

fr tesla:
# Exactly our point. Since the end result should be a Ruby teaching
# situation we found that Rails got in the way.

indeed. teaching ruby thru rails is quite a hurdle. my own personal experience only btw.

# Also students would need
# two books (budgets you know) rather than one :wink:

request the agile team to provide academic editions :slight_smile:

# Also I truly dislike that acronym FUD. It is thrown about
# too often when
# people are giving their experiences, outlook and opinion.
# None or us fear
# Rails, are uncertain about its purpose nor doubt that its
# capabilities. We
# just decided based on our own conferencing and
# experimentation not to go
# with Rails this time and we gave our reasons why.

fwiw, my kids (2 high and 1 grade) prefer Nitro (just because they are nubies and ergo not ready for rails advanced programming).

try ruby and nitro. I assure you you wont regret it.

kind regards -botp