From 40cb7c43e9bf696e80a791ebb7f42beca0b05f84 Mon Sep 17 00:00:00 2001 From: "Katherine G. Pe" Date: Mon, 18 Nov 2013 22:23:10 +0800 Subject: [PATCH] Updated Heroku deployment guide fixes #sinatra/sinatra-book/#62 --- book/Deployment.markdown | 43 +++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/book/Deployment.markdown b/book/Deployment.markdown index 1ac4389..b348323 100644 --- a/book/Deployment.markdown +++ b/book/Deployment.markdown @@ -11,32 +11,43 @@ pushing to a remote git repository. Steps to deploy to Heroku: * Create an [account](http://heroku.com/signup) if you don't have one -* `gem install heroku` +* Download and install [Heroku toolbelt](https://toolbelt.heroku.com/) +* Make sure you have a `Gemfile`. Otherwise, you can create one and install the `sinatra` gem using `bundler`. * Make a config.ru in the root-directory * Create the app on heroku * Push to it -1. Here is an example config.ru file that does two things. First, it requires +1. Install `bundler` if you haven't yet (`gem install bundler`). Create a `Gemfile` using `bundle init`. Modify your `Gemfile` to look like: + + ```ruby + source 'http://rubygems.org' + + gem 'sinatra' + ``` + + Run `bundle` to install the gem. + + It is possible to specify a specific Ruby version on your Gemfile. + For more information, check [this](https://devcenter.heroku.com/articles/ruby-versions). + +2. Here is an example config.ru file that does two things. First, it requires your main app file, whatever it's called. In the example, it will look for - `myapp.rb`. Second, run your application. If you're subclassing, use the + `myapp.rb`. Second, run your application. If you're subclassing, use the subclass's name, otherwise use Sinatra::Application. -```ruby -require "myapp" - -run Sinatra::Application -``` + ```ruby + require "myapp" -2. Create the app and push to it + run Sinatra::Application + ``` - From the root-directory of the application +3. Create the app and push to it -``` -$ heroku create # This will add heroku as a remote -$ git push heroku master -``` + From the root directory of the application, run these commands: -For more details see [this](http://github.com/sinatra/heroku-sinatra-app) + $ heroku create # This will add heroku as a remote + $ git push heroku master -[Heroku]: http://www.heroku.com + For more details see [this](http://github.com/sinatra/heroku-sinatra-app). + [Heroku]: http://www.heroku.com