On Wed, Dec 8, 2010 at 10:23 PM, Jesse Jurman <e.j.jurman / gmail.com> wrote:

> I have been programming in Ruby for a while and have made several
> personal applications, so I'd like to say I'm not a complete novice when
> it comes to Ruby, and programming in general; however I have not gone as
> far as the complexities involved in Ruby on Rails (it's more or less the
> multiple class/files setup).
>
> I want to make a website with Ruby for a group I'm in, nothing
> complicated (no forums or accounts), and while this is suppose to be a
> simple read-only type website, whenever I look for making websites with
> Ruby, I'm always redirected to a Ruby on Rails page. Is this something
> that can be done with just Ruby, or would I be better off to learn Ruby
> on Rails?
>
> Any tutorials, tips, or links would be greatly appreciated.
>
> -JRJurman
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
It sounds like you just want a static site (content doesn't change), with
simple pages that you serve up to the user? If so, the simplest way to do it
is just write it with HTML.

-------------------------

A step up from there would be to generate the pages with ERB, this would
allow you to do some calculations in the page at the time you compile them
to HTML. For example:

require 'erb'
template = <<-HTML
<ul>
  <% ('a'..'z').each do |char| %>
    <li><%= char %></li>
  <% end %>
</ul>
HTML
puts ERB.new(template,nil,'>').result

-------------------------

A step up from there would be to go to a static site framework, here is a
pretty good list:
http://ruby-toolbox.com/categories/static_website_generation.html

-------------------------

A step up from there would be a simple dynamic website, probably with a
database. I'd suggest Sinatra, and the Sinatra screencast from Peepcode
shows a good example.

-------------------------

And of course, you'll need to host it somewhere. Heroku is fast and easy for
this sort of thing (though you need to know git -- or at least how to add ,
commit , and push) For a static site, you will want this hierarchy:

|-- config.ru
`-- public
    |-- file1.html
    `-- index.html

Where "public" contains your static html files that you want to serve up,
and "config.ru" has the contents:

run lambda { |env|
  if env['PATH_INFO'] == '/'
    [301, { 'Location' => '/index.html' , 'Content-Type' => 'text/html' },
[''] ]
  else
    Rack::File.new(File.dirname(__FILE__)+"/public").call(env)
  end
}

-------------------------

Final thoughts: I'm going to recommend against serving Sinatra on Heroku,
you have to know what you're doing and be able to go digging through their
source code to troubleshoot errors stemming from not using Rails. For that,
you might look into Engine Yard, I haven't used them, but they repeatedly
impress me, and are supposed to be willing to work with you if you need it.

If your site is more than trivially dynamic, I think Rails is better than
Sinatra. I worked on a moderately sized Sinatra project where quite a bit of
time was spent dealing with not having the niceties of Rails accessible.

If this is your first dynamic site, and you are debating between Sinatra and
Rails, go with Sinatra. You will be overwhelmed with Rails, but Sinatra is
pretty easy to grok. It also will get you comfortable enough with the
concepts that Rails will be much easier for you afterward.