Making a Website with Ruby (not rails?)

Discussion in 'Ruby' started by Jesse Jurman, Dec 9, 2010.

  1. Jesse Jurman

    Jesse Jurman Guest

    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/.
     
    Jesse Jurman, Dec 9, 2010
    #1
    1. Advertising

  2. Steve Klabnik, Dec 9, 2010
    #2
    1. Advertising

  3. Jesse Jurman

    Dhruva Sagar Guest

    [Note: parts of this message were removed to make it a legal post.]

    +1 for Sinatra, it is damn easy to use and get started with, the source of
    sinatra isn't very long either, you can actually read it and understand it
    yourself.

    --
    Thanks & Regards,
    Dhruva Sagar.



    On Thu, Dec 9, 2010 at 09:56, Steve Klabnik <> wrote:

    > Check out Sinatra and/or Camping.
    >
    > http://www.sinatrarb.com/
    >
    > http://whywentcamping.com/
    >
     
    Dhruva Sagar, Dec 9, 2010
    #3
  4. Jesse Jurman

    Stu Guest

    On Wed, Dec 8, 2010 at 10:23 PM, Jesse Jurman <> 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/.
    >
    >


    This one looks interesting:

    http://ramaze.net/learn/getting-started
     
    Stu, Dec 9, 2010
    #4
  5. Jesse Jurman

    Rainer Frey Guest

    Jesse Jurman wrote:

    > 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,


    What part or aspect of the web site do you want to do in ruby then?

    Rainer
     
    Rainer Frey, Dec 9, 2010
    #5
  6. Jesse Jurman

    Josh Cheek Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Wed, Dec 8, 2010 at 10:23 PM, Jesse Jurman <> 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.
     
    Josh Cheek, Dec 9, 2010
    #6
  7. Horse for courses. Pick something like Joomla, or if the content doesn't
    change much, just draw it with something like Xara Web.

    --
    Posted via http://www.ruby-forum.com/.
     
    Mike Stephens, Dec 9, 2010
    #7
  8. [Note: parts of this message were removed to make it a legal post.]

    >
    > 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.




    Have you tried hosting Sinatra on Heroku? This simply isn't true.
     
    Steve Klabnik, Dec 9, 2010
    #8
  9. Jesse Jurman

    Josh Cheek Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Thu, Dec 9, 2010 at 5:47 AM, Steve Klabnik <>wrote:

    > >
    > > 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.

    >
    >
    >
    > Have you tried hosting Sinatra on Heroku? This simply isn't true.
    >


    Yes, I have. I did have to go looking through the Heroku gem maybe 2 or 3
    times. It is simple things that you would not think about, like your
    database.yaml file must be in a folder named config, in your project root,
    and the keys in that file must be strings, not symbols. Whoops, even that
    isn't right, it must end in yml, not in yaml. You don't have to think about
    that in Rails, Rails just does that, but in not Rails, you need to know.
     
    Josh Cheek, Dec 9, 2010
    #9
  10. [Note: parts of this message were removed to make it a legal post.]

    Interesting. I have half a dozen Sinatra projects on Heroku, and I never had
    to deal with any of those issues. I guess I just got lucky with my config
    setup...
     
    Steve Klabnik, Dec 9, 2010
    #10
  11. Jesse Jurman

    Josh Cheek Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Thu, Dec 9, 2010 at 10:16 AM, Steve Klabnik <>wrote:

    > Interesting. I have half a dozen Sinatra projects on Heroku, and I never
    > had
    > to deal with any of those issues. I guess I just got lucky with my config
    > setup...
    >


    You probably were smarter about it than I was. I followed some Rails
    conventions where they made sense, and digressed where it seemed appropriate
    or where I wasn't checking to see how Rails had done it. Those digressions
    were a mistake, and I think I regretted almost all of them. I looked at the
    heroku code now, and it looks like it is much friendlier about explaining to
    you why whatever you were trying to do didn't work, but it used to silently
    rescue exceptions and just not work, or fail somewhere else further on, so I
    had to load up the gem, and follow it down from the binary to see where it
    was going wrong.
     
    Josh Cheek, Dec 9, 2010
    #11
  12. Jesse Jurman

    Jesse Jurman Guest

    Thanks for the responses, I really just want to avoid using HTML, as I
    have had trouble both setting it up file wise, as well as graphics wise.
    I'm glad there are a multitude of different solutions involving ruby,
    and I'll defiantly check them out later today!

    --
    Posted via http://www.ruby-forum.com/.
     
    Jesse Jurman, Dec 10, 2010
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    187
    Michael Campbell
    Mar 17, 2005
  2. Michael Schuerig
    Replies:
    3
    Views:
    227
    Carl Youngblood
    Jun 17, 2005
  3. Josef 'Jupp' SCHUGT
    Replies:
    5
    Views:
    178
    Stephan Kämper
    Jan 24, 2006
  4. Nathaniel Brown
    Replies:
    2
    Views:
    138
    gabriele renzi
    Mar 26, 2006
  5. Jason Wong
    Replies:
    0
    Views:
    171
    Jason Wong
    Nov 20, 2007
Loading...

Share This Page