Skip to content

Instantly share code, notes, and snippets.

@bborn
Created November 12, 2009 20:11
Show Gist options
  • Save bborn/233235 to your computer and use it in GitHub Desktop.
Save bborn/233235 to your computer and use it in GitHub Desktop.
a simple script to automate deploying a CE app with submodules to heroku
desc "Deploy to Heroku"
task :deploy_heroku do
app = 'myappname'
temp_path = "/tmp/heroku-deploys/#{app}"
deploy_path = "~/heroku-deploys/#{app}"
system "mkdir -p #{temp_path}"
system "rm -rf #{temp_path}/*"
system "tar -C . -cf - . | tar -C #{temp_path}/ -xpf -"
system "cd #{temp_path} && find . -regex '.*git.*' -exec rm -rf {} \\;"
system "cd #{temp_path} && find . -regex '.*DS_S.*' -exec rm -rf {} \\;" #I'm on a Mac, and wanted to get rid of these files
system "cp -R #{temp_path}/* #{deploy_path}"
system "cd #{deploy_path} && git add . && git commit -a -m 'Updating #{app} App' && git push heroku master"
end
## Make sure that deploy_path exists and is a git repo with heroku as a remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment