Web Ruby w/o Rails


#1

Hi,

I want to start developing a web application in Ruby, but can’t
configure it
to work. There are so much options that I get confused :slight_smile:
eruby, mod_ruby (which I think, but unsure, is depreciated), cgi,
fastcgi…

I can’t get the simple “hello world” :frowning:

I’m with strong C# and PHP background, currently using PHP but hitting
it’s
limits for some time now, basically because of the lack of late static
binding.

I will be very grateful if you help me get started.

Regards,
Emil I.


#2

Emil - what are you using as a web server? Platform? Configured to
recognize and run ruby files? You said you can’t get it to work, but
what does that mean? What happens on the browser? What appears in the
logs?


#3

Hey Emil,
If you think it might help and you’re on windows I could send you my
notes for setting up a web-based ruby-on-rails application. It uses
lighttpd to serve it up and sqlite for the back end.

Let me know if you want them, maybe they’ll help you get started.

  • David

Емил Иванов / Emil I. removed_email_address@domain.invalid wrote:
Hi,

I want to start developing a web application in Ruby, but can’t
configure it
to work. There are so much options that I get confused :slight_smile:
eruby, mod_ruby (which I think, but unsure, is depreciated), cgi,
fastcgi…

I can’t get the simple “hello world” :frowning:

I’m with strong C# and PHP background, currently using PHP but hitting
it’s
limits for some time now, basically because of the lack of late static
binding.

I will be very grateful if you help me get started.

Regards,
Emil I.

My place to share my ideas:
http://vladev.blogspot.com


#4

Hi Emil,

Have you had a look at Camping:
http://code.whytheluckystiff.net/camping/. It looks pretty cool.

It has instructions for serving your app with lighttpd and apache.

Cheers,
Mark


#5

I want to start developing a web application in Ruby, but can’t configure it
to work. There are so much options that I get confused :slight_smile:
eruby, mod_ruby (which I think, but unsure, is depreciated), cgi, fastcgi…

I can’t get the simple “hello world” :frowning:

I’m with strong C# and PHP background
[…]
Add an HTTP background and you will be fine. :slight_smile:

I will be very grateful if you help me get started.

We do not know what environment you are working
in and what your experience/knowledge is. So,
sorry if this answer is too basic or trivial.

The most common thing that is very likely to
be available on whatever web server you are using
might be CGI. Very likely that your web server has
a directory called cgi-bin. Ask your sysadmin or

  • for Apache - check the httpd.conf to see details.

Assuming your web server has such a directory and
the execution of CGIs is enabled there (most often
the default setting), create a file in this directory,
name it ‘test.rb’ and put the following in this file:

#!/usr/local/bin/ruby
puts “Content-Type: text/plain\n\n”,
“Hello world”

Of course,this is a very basic way to work.
However, using the modules ERB and CGI it is even
possible to keep design and logic separated.

It doesn’t work?

  • chmod 755 test.rb
  • Did you forget the two newlines after the Content-Type line?
  • Ask the administrator if your web server configured to run CGIs.

HM


#6

??? ??? / Emil I. wrote:

Hi,

I want to start developing a web application in Ruby, but can’t
configure it
to work. There are so much options that I get confused :slight_smile:
eruby, mod_ruby (which I think, but unsure, is depreciated), cgi,
fastcgi…

I can’t get the simple “hello world” :frowning:

Take a look at Nitro.

Here’s a Web “app” in a Ruby one-liner:

$ ruby -rubygems -e “require ‘nitro’; class C; def index; print
‘Hello, world!’;end;end; Nitro.start©”

Browse to 127.0.0.1:9000 to see the results.

How simple or complex you want your app to be is up to you.

See http://nitroproject.com/


#7

On 24 Jun 2007, at 09:16, Емил Иванов / Emil I. wrote:

configure it for ruby. I also want that erb to work, but i think I
will
since it’s written in ruby.

Hi Emil,

If you want some examples of how to do this stuff from scratch, my
RailsConf Europe presentation from last year is available at http://
www.slideshare.net/feyeleanor/camping-going-off-the-rails-with-ruby.
A significant proportion of the text covers how to roll your own web
application framework using WEBrick and the code examples should be
sufficient for that purpose.

Ellie

Eleanor McHugh
Games With Brains

raise ArgumentError unless @reality.responds_to? :reason


#8

Thank you for responding so fast to all of you!

The platform is a Windows XP, Apache 2 and 2.2, MySQL 5 as a database.
(I must have been sleeping while I was writing the post…)

Note that I don’t want any frameworks, although I will check the one you
suggested - I just want a simple hello world for now.
The fastcgi module is installed on the apache 2, but I don’t know how to
configure it for ruby. I also want that erb to work, but i think I will
since it’s written in ruby.

Regards,
Emil I.