Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Last active August 29, 2015 13:57
Show Gist options
  • Save mathildathompson/9522662 to your computer and use it in GitHub Desktop.
Save mathildathompson/9522662 to your computer and use it in GitHub Desktop.
##DEPLOYING TO HEROKU
#Create an account on Heroku
https://www.heroku.com
#Download Heroku Toolbelt (a client for generating and creating heroku apps);
https://toolbelt.heroku.com/
heroku login #in the command line #It should generate SSH keys (we may have to do this manually);
#Gem list and check that you have the gem bundler; (You can do gem list | grep bundler);
#If you do not have it then install it:
gem install bundler #We have already done this;
#Bundler manages the gems that you application depends on;
#If your application depends on gems you do not have it will install the gem from https://rubygems.org;
#It will make sure that all the gem versions are compatible with each other;
#Bundler creates a Gemfile.Lock this specifies the exact version of each gem that you are using (you will notice when you type bundle, the Gemfile.Lock will be updated);
#Bundler helps you update your Gemset when new gems become available;
#Add to the top of your main.rb
source 'https://rubygems.org'
require 'sinatra'
#If there are gems that you only want to require in development you can group theem;
if development?
require 'pry'
end
#Add a config.ru file to the root of the application folder;
#This tells our application to run;
require './main.rb'
run Sinatra::Application
#Add a Gemfile to the root of the application
#Even if we have nothing in the Gemfile we still need one so heroku can recognise its a Rack application;
gem 'sinatra'
#If you have gems that you only want in development;
group :development do
gem 'pry'
gem 'sinatra-reloader'
end
#Login to your heroku account form the comamnd line;
heroku login
#Type bundle into the command line (you should see that a Gemfile.Lock has been created);
#Initialize an empty git respository, check that you dont already have one by typing git status;
git init
#Add and commit your changes
git add
git commit -m "Your message"
#Create an empty heroku respository
heroku create
#Push up your code into this empty heroku repo (very similar to pushing up the code to a repo on Github);
git push heroku master
heroku open #Make sure you go to the route in the application or it will say NOT FOUND;
## IF WE NEED TO GERNERATE SSH KEYS
cd ~/.ssh
ls #To check if we have generated SSH keys;
#If you have nothing here follow this link; https://help.github.com/articles/generating-ssh-keys;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment