# How to go from a ruby script to a working website?

**URL:** <https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050>\
**Category:** Ruby\
**Created:** [October 16, 2008, 11:19am UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050 "2008-10-16T11:19:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 11:19am UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/1 "2008-10-16T11:19:36Z")

</div>

As you’ve probably guessed by the title, total newbie here.

My main interest is developing web stuff, and for that I started  
learning programming through PHP. However, I discovered Ruby and  
immediately fell in love with it.

I started following Chris P.'s Learn to Program and with the knowledge  
I got so far, I started building a few very simple programs of my own.  
The thing is that they’re all limited to the Terminal (I have a mac),  
but what I really want is to use them through a web interface (inputs,  
forms, submit, etc) so I can also experiment with Javascript/AJAX.

However, I have no clue how to do that and can’t seem to find  
information on it anywhere. It seems the only way to access Ruby  
programs through a webpage is with the aid of frameworks like Rails and  
Merb, and they seem like too much trouble for what would be a simple  
one-page app. I guess could use Camping or only the Merb-core, but I  
would like to understand exactly what I’m doing, and just basically be  
able do it all by myself.

So, what am I missing? What is the link between .rb and .html?

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 11:57am UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/2 "2008-10-16T11:57:24Z")

</div>

You could use the Merb-core in combination with the passenger mod for  
Apache. That mod allows you to run rails and merb applications just like  
php applications. Just upload and go. And indeed you could use Rails,  
but it’s easier to start with a merb application.

Example:  
[http://www.modrails.com/documentation/Users%20guide.html#\_merb](http://www.modrails.com/documentation/Users%20guide.html#_merb)

As you can see passenger mod supports multiple simple frameworks. So  
maybe you could try one of those.

Regards,

Daniel

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 12:35pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/3 "2008-10-16T12:35:05Z")

</div>

On Thu, Oct 16, 2008 at 8:56 PM, Hoesel, DaniÃ«l van \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> As you’ve probably guessed by the title, total newbie here.
> 
> \

Using merb-core for a one page app is not a silly idea. You can use it  
with  
a very\_flat (1 file) merb application.

to genearte the stubs to get you going for this use

merb-gen very\_flat my\_app

then run it with

merb -I \<app\_file\>

HTH  
~Daniel

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 2:29pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/4 "2008-10-16T14:29:53Z")

</div>

On Oct 16, 5:19 am, Ralph W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> forms, submit, etc) so I can also experiment with Javascript/AJAX.
> 
> However, I have no clue how to do that and can’t seem to find  
> information on it anywhere. It seems the only way to access Ruby  
> programs through a webpage is with the aid of frameworks like Rails and  
> Merb, and they seem like too much trouble for what would be a simple  
> one-page app. I guess could use Camping or only the Merb-core, but I  
> would like to understand exactly what I’m doing, and just basically be  
> able do it all by myself.
> 
> So, what am I missing? What is the link between .rb and .html?

start with cgi.rb  
learn about webrick  
comprehend rack  
all “explodes” from there

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/5 "2008-10-16T15:00:29Z")

</div>

Take a look at one of the frameworks that has been built on top of Ruby  
such as Merb or Rails

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/6 "2008-10-16T15:37:04Z")

</div>

Ralph W. wrote:

> they seem like too much trouble for what would be a simple  
> one-page app. I guess could use Camping or only the Merb-core, but I  
> would like to understand exactly what I’m doing, and just basically be  
> able do it all by myself.

For a one-pager app, look at Sinatra. I’ve only given it a quick try,  
but it looks a lot cleaner and simpler than Camping.

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/7 "2008-10-16T23:28:01Z")

</div>

Thanks for all the replies.

I’ve looked into your suggestions with more depth, and the possibility  
I’m liking the most is the Phusion’s Passenger mod.

But first I think I’m gonna try liquid’s mini-tutorial on how to use  
just merb-core to get a one-page app working. It looks like the more  
hands-on approach, and it’s what I’m looking for at the moment.

I had read about Sinatra earlier, but it looks like the project is  
offline. Vintage looks interesting, but it appears to be somewhat  
abandoned.

Just something else that isn’t quite clear to me: my app should be  
written in an erb file, right? Or HAML or the like.

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/8 "2008-10-16T23:40:58Z")

</div>

On Fri, Oct 17, 2008 at 8:27 AM, Ralph W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> offline. Vintage looks interesting, but it appears to be somewhat  
> abandoned.
> 
> Just something else that isn’t quite clear to me: my app should be  
> written in an erb file, right? Or HAML or the like.
> 
> –

Hi Ralph,

You can use erb or haml for your views. It depends on what you’re  
comfortable with. My personal preference is haml but each to his own.

Cheers  
Daniel

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 16, 2008, 6:19pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/9 "2008-10-16T18:19:47Z")

</div>

On Thu, Oct 16, 2008 at 5:19 AM, Ralph W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> forms, submit, etc) so I can also experiment with Javascript/AJAX.
> 
> However, I have no clue how to do that and can’t seem to find  
> information on it anywhere. It seems the only way to access Ruby  
> programs through a webpage is with the aid of frameworks like Rails and  
> Merb, and they seem like too much trouble for what would be a simple  
> one-page app. I guess could use Camping or only the Merb-core, but I  
> would like to understand exactly what I’m doing, and just basically be  
> able do it all by myself.
> 
> So, what am I missing? What is the link between .rb and .html?

Vintage may be of interest to you, although the documentation seems to  
be sparse.

[http://rubyforge.org/projects/vintage/](http://rubyforge.org/projects/vintage/)

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 19, 2008, 8:20pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/10 "2008-10-19T20:20:54Z")

</div>

On Thu, Oct 16, 2008 at 09:57:06PM +0900, Jim McKerchar wrote:

> Take a look at one of the frameworks that has been built on top of Ruby  
> such as Merb or Rails

With an answer like that, I’m not sure you actually read the OP.

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 17, 2008, 12:03am UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/11 "2008-10-17T00:03:15Z")

</div>

On Thu, Oct 16, 2008 at 5:27 PM, Ralph W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks for all the replies.
> 
> I’ve looked into your suggestions with more depth, and the possibility  
> I’m liking the most is the Phusion’s Passenger mod.
> 
> But first I think I’m gonna try liquid’s mini-tutorial on how to use  
> just merb-core to get a one-page app working. It looks like the more  
> hands-on approach, and it’s what I’m looking for at the moment.

I think merb is a great choice.

> I had read about Sinatra earlier, but it looks like the project is  
> offline. Vintage looks interesting, but it appears to be somewhat  
> abandoned.

I want to point out that just because there hasn’t been a Vintage  
release in awhile does not mean it has been abandoned. It’s purpose  
is relatively simple and probably does not require many updates.

Michael G.

---

<div class="post-metadata">

**Author:** ![toltec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@toltec](https://www.ruby-forum.com/u/toltec)\
**Post date:** [October 19, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/how-to-go-from-a-ruby-script-to-a-working-website/151050/12 "2008-10-19T20:30:53Z")

</div>

On Thu, Oct 16, 2008 at 06:19:14PM +0900, Ralph W. wrote:

> However, I have no clue how to do that and can’t seem to find  
> information on it anywhere. It seems the only way to access Ruby  
> programs through a webpage is with the aid of frameworks like Rails and  
> Merb, and they seem like too much trouble for what would be a simple  
> one-page app. I guess could use Camping or only the Merb-core, but I  
> would like to understand exactly what I’m doing, and just basically be  
> able do it all by myself.

For extremely simple stuff – like turning a basic command-line utility  
into a Web application – I use the hell out of eRuby. The Wikipedia  
page for eRuby offers a little information about it, including some  
“hello world” level examples and brief mentions of three different  
implementations:

[eRuby - Wikipedia](https://secure.wikimedia.org/wikipedia/en/wiki/ERuby)

The way it’s used, once you get it working, is surprisingly similar to  
how PHP is used with mod\_php on most Webservers. The difference is  
primarily that it uses Ruby instead of PHP (obviously), in terms of how  
one interacts with it. There are a few gotchas in making the transition  
from PHP to eRuby, though, as a bunch of stuff works subtly differently  
(such as default paths).
