cristian d. wrote in post #1062052:
> Hi ! im new to ruby and i was wondering if there is possible (i know it
> must be) to autorun my scripts .rb.
>
> For example, when i create a .php i only upload to my home-server and
> search url local-ip/home/web/My_script.php and i can test it.

Although it can be done, and is OK just for playing, it's not a good way 
to run ruby apps.

You *can* embed a ruby interpreter into Apache using mod_ruby (which is 
very old and unmaintained). There is even erb/rhtml which is ruby 
embedded in HTML. This has the same problem as PHP in that all pages and 
applications are sharing the same interpreter instance - however this is 
worse for ruby because individual pages can modify core classes which in 
turn can interfere with the operation of every other page.

You *can* write ruby scripts which are CGIs, and there is a ruby CGI 
library with helper methods. However this will start up a fresh ruby 
interpreter for every single request which comes in, which well then 
have to load from scratch all the libraries you are using, make a fresh 
connection to a database if you have one, and so on. This will give very 
poor performance except for small scripts with few dependencies (and for 
this, you definitely don't want to be running jruby!)

These days, everyone writes ruby web applications using an API called 
'Rack' which adapts HTTP requests to ruby method calls in a persistent 
process. Coding directly to the native rack API is rather like CGI 
programming but without the helpers, so people use some sort of 
framework on top, from the simple and lightweight Sinatra to the huge 
and featureful Rails.

You then run instances of your app as persistent Ruby webservers and 
proxy to them from a HTTP frontend - or you use Phusion Passenger which 
embeds Rack support into Apache or Nginx.

If you administer your own webserver then Phusion Passenger is pretty 
easy to add (there are step-by-step instructions) and it will 
dynamically run your app after it has been uploaded.

-- 
Posted via http://www.ruby-forum.com/.