Skip to content

Instantly share code, notes, and snippets.

@bastos
Created February 10, 2009 23:02
Show Gist options
  • Save bastos/61669 to your computer and use it in GitHub Desktop.
Save bastos/61669 to your computer and use it in GitHub Desktop.
# Based on:
# http://github.com/bmizerany/heroku-sinatra-app
# http://www.sinatrarb.com/book.html#heroku
# trial-and-error
#
# I tried using Blake's sample code from github,
# but for some reason my Heroku.com app was running in
# a directory called /mnt. This did not correspond to the
# name of my app. The code below is more explicit when it
# comes to the name of the app file. That is the only difference.
#
# Note: This is for Heroku.com, not Herokugarden.com.
# The difference is that Heroku.com is running the latest Sinatra gem.
# Herokugarden.com is running the older Sinatra gem.
# More info. at this thread:
# http://groups.google.com/group/sinatrarb/browse_thread/thread/1f550adbd57a7805/eb83105300749113?lnk=gst&q=heroku#
# ============================================================
# FILE: config/rackup.ru
# ============================================================
require 'rubygems'
require 'sinatra'
my_app_root = File.expand_path( File.dirname(__FILE__) + '/..' )
set :environment, :production # Don't use :env
set :public, my_app_root + '/public'
disable :run, :reload
# For this sample, we will name our sinatra start file:
# start_me_up.rb
# But you can name it whatever you want.
require( my_app_root + "/start_me_up.rb" )
run Sinatra::Application
# ============================================================
# FILE: start_me_up.rb
# ============================================================
require "rubygems"
require "sinatra"
configure :production do
error do
"Error. Come back later."
end
not_found do
"Insert cool 404 content here."
end
end
get '/' do
%(
Ok... if you see this message,
you are good to go for Sinatra @ The Heroku Nightclub.
)
end
__END__
#
# Setup git and install the Heroku gem ("gem install heroku").
# Then:
#
cd myapp
(...make edits...)
git init
git add .
git commit -m "my new app"
heroku create myapp
git remote add heroku git@heroku.com:myapp.git
git push heroku master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment