Wednesday, August 15, 2012

Sinatra App On Heroku

As promised in an earlier post, here is a screenshot of the web app I created using this Sinatra/HAML tutorial from nettuts...

There's not much to it. I am still playing with the code, add more pages to it over time. If you want to see the page, here is the link.

This is my web.rb at the moment...
require "sinatra"
#require "bundler/setup"
require "haml"
require 'coffee-script'

get '/' do
  haml :index

get '/about' do
  haml :about

get '/contents' do
  haml :contents

not_found do
  halt 404, 'Page Not Found.'

I decided to comment out require "bundler/setup". I was getting an error--can't remember where. It was either on production, or when I deploy to the heroku server. I think it was the heroku server. The error message had something to do with bundle.

Looking for answers, the shortcut I found said it was better to do bundle install on production (my own pc) before making git commit..., then doing git push heroku master. This way, only the important stuff are on the heroku server. Does that make sense to you?

Even so, you will see that the web app runs even after I comment out require "bundler/setup".

Here is my Gemfile...
source ''
gem 'sinatra', '1.1.0'
gem 'thin'
gem 'haml'
gem 'coffee-script'

...and my Procfile
web: bundle exec ruby web.rb -p $PORT

No comments:

Post a Comment