Skip to content

Instantly share code, notes, and snippets.

@jhorikawa
Last active September 5, 2015 18:18
Show Gist options
  • Save jhorikawa/d52a2ae2d4e4be60a0b5 to your computer and use it in GitHub Desktop.
Save jhorikawa/d52a2ae2d4e4be60a0b5 to your computer and use it in GitHub Desktop.
Ruby on RailsをCloud9からHerokuへデプロイするセットアップ覚書 ref: http://qiita.com/jhorikawa/items/84a0f4a7f40f5914ad1a
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def hello
render text: "Hello World"
end
end
~/workspace $ gem install rails -v 4.2.2
~/workspace $ rails _4.2.2_ new sample_app
~/workspace $ cd sample_app
~/workspace $ bundle install --without production
~/workspace/sample_app (master) $ bundle install
~/workspace/sample_app (master) $ git add -A
~/workspace/sample_app (master) $ git commit -m "Updated Gemfile"
~/workspace/sample_app (master) $ git push heroku master
~/workspace/sample_app $ rails server -b $IP -p $PORT
~/workspace/sample_app $ git config --global user.name "My Name"
~/workspace/sample_app $ git config --global user.email sample@sample.com
~/workspace/sample_app $ git config --global push.default matching
~/workspace/sample_app $ git config --global alias.co checkout
~/workspace/sample_app $ git init
~/workspace/sample_app (master) $ git add -A
~/workspace/sample_app (master) $ git commit -m "Initialize"
git remote add origin git@bitbucket.org:XXX/sample_app.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
~/workspace/sample_app (master) $ heroku login
~/workspace/sample_app (master) $ heroku create
~/workspace/sample_app (master) $ git push heroku master
# You can have the root of your site routed with "root"
root 'application#hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment