How to upload a simple ruby file to a webpage

I have finally managed to program simple formulae in Ruby for my work.My
problem now is how to upload this on to my web page and use it online in
an interactive manner or as a standalone file similar to an .exe or some
other packaged file. Yes i have read about gems, RoR, Sinatra and
smaller webframe work etc…but how do i do it with a file. Can anyone
help me here with this, either by sending me a link of the steps
involved or just
send me the steps in uploading a packaged ruby file. Attaching a file
with a simple formula in chemistry. Would really appreciate it. Thanking
in advance.

T J Pereira wrote in post #1025373:

I have finally managed to program simple formulae in Ruby for my work.My
problem now is how to upload this on to my web page and use it online in
an interactive manner or as a standalone file similar to an .exe or some
other packaged file. Yes i have read about gems, RoR, Sinatra and
smaller webframe work etc…but how do i do it with a file.

If you want an application “on [your] web page and use it online” then
it needs to be a web application: something which accepts its input from
a web browser using HTTP and returns its results as HTTP.

So you need to write an application which works in that way - the
simplest way being with something like Sinatra, which takes care of the
HTTP nuts and bolts for me. Then you find a web server which supports
rack for hosting it. If you have a web server which supports only CGI
then you can instead write it as a CGI application.

What you’ve written is a script which uses “gets” and “puts”. I can
assure you that it is not going to run as a web app, period. (Well,
there used to be a “try ruby” website which let you post ruby scripts
directly in, I don’t know if it still exists - but I doubt that’s what
you’re looking for)

Hi, brian
Tq so much for answering my question. I am now clear about what the
program Ruby can/cant do and the role of web frameworks such as Sinatra
and RoR etc. Phew…

On Thu, Oct 6, 2011 at 9:57 AM, T J Pereira [email protected] wrote:

Attachments:
http://www.ruby-forum.com/attachment/6661/test.rb


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

Hi, this isn’t going to work, try instead creating a form with fields
for
the things you are getting from “gets” and posting to a url that renders
back the result.

I’d recommend Sinatra for this (or even pure rack), if you need some
idea of
how to do this, check out Ruby Kickstart session 6
http://ruby-kickstart.com/#session6 It assumes you’ve worked through the
previous five sessions, but it will show you how to create a Sinatra
application and host it on the internet (Heroku).