How to make Ruby code into website?

Hello, I am new to computer programming for the most part.

I made a small amount of simple code and would like to know how to
publish it into a website.

For example (in psuedo code)

  1. Prompt for user’s name
  2. Output user input backwards

so this website would reverse the person’s name. (This is just an
example, not what I am trying to actually publish)

So how would I go about turning this code into a website people would
visit to have their names generated backwards?

I don’t even know how to run the code in the “Command Prompt with Ruby”
thing.

Before you think about using Ruby for your website does your web host
allow Ruby to work on it’s servers? Ask them.

To run a Ruby program from the command prompt navigate to where the
program is on your computer, for example your desktop.

Open command prompt then write in cd desktop you should then be on your
desktop where your program is.

Write in ruby filename.rb and press enter. (filename is of course
replaced by the name you gave your file.)

For a website running Ruby code you’ll probably want Ruby on Rails.

However, if you don’t even know the basics of Ruby I’d emphatically
recommend learning Ruby first.
There are plenty of good tutorials out there which are just a quick
Google away from your fingertips.
http://www.ruby-lang.org/en/documentation/quickstart/

Hello,

On 13 Αυγ 2013, at 23:22 , Norie92 … [email protected] wrote:

example, not what I am trying to actually publish)

So how would I go about turning this code into a website people would
visit to have their names generated backwards?

Doesn’t prompt for a user, but using Sinatra [1] you can easily do
something like this:

#!/usr/bin/env ruby

encoding: UTF-8

require ‘sinatra’

get ‘/:name’ do
“Hi #{params[:name].reverse}”
end

If you run this code and browse to localhost:4567/mario you can see the
result. However that’s just the tip of the iceberg for a full featured
application.

I don’t even know how to run the code in the “Command Prompt with Ruby”
thing.

Fix that first, then you can start writing web-apps. Doesn’t work the
other way around.

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5