Skip to content

Instantly share code, notes, and snippets.

@bayendor
Forked from novohispano/deploy.rake
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayendor/207ac00886cb18a8a7f4 to your computer and use it in GitHub Desktop.
Save bayendor/207ac00886cb18a8a7f4 to your computer and use it in GitHub Desktop.
namespace :deploy do
desc "Deploys app to Github & production."
task all: :environment do
if system("rake test:all") == false
puts "The tests fail."
break
end
puts "The tests passed."
puts "Pushing to Github"
if system("git push origin master") == false
puts "Couldn't push to Github"
break
end
puts "Done."
puts "Pushing to Heroku"
if system("git push heroku master") == false
puts "Couldn't push to Heroku"
break
end
puts "Done."
puts "Running migrations"
if heroku("rake db:migrate") == false
puts "Could't run migrations"
break
end
puts "Done."
end
end
def heroku(command)
system("GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/local/heroku/bin/heroku run #{command}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment