Skip to content

Instantly share code, notes, and snippets.

@lstoll
Created May 1, 2010 11:31
Show Gist options
  • Save lstoll/386254 to your computer and use it in GitHub Desktop.
Save lstoll/386254 to your computer and use it in GitHub Desktop.
desc "deploys to heroku"
task :heroku_deploy do
# create the git repo
`cd #{RAILS_ROOT} && mkdir .heroku_cache && cd .heroku_cache && git init`
# update files
`rsync -a --exclude=config/database.yml --exclude=.svn --exclude=.hg --exclude=.heroku_cache --delete #{RAILS_ROOT}/* #{RAILS_ROOT}/.heroku_cache/ `
# git addremove
`cd #{RAILS_ROOT}/.heroku_cache && git add -A && git ls-files --deleted -z | xargs -0 git rm`
# git commit
`cd #{RAILS_ROOT}/.heroku_cache && git commit -m 'deploy commit'`
# git add remote
`cd #{RAILS_ROOT}/.heroku_cache && git remote add heroku [email protected]:ngipdatabase.git `
# git force push
`cd #{RAILS_ROOT}/.heroku_cache && git push -f heroku master`
# migrate DB
`heroku rake db:migrate --app ngipdatabase`
puts "Done."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment