lib/heroku_deploy/tasks.rb in heroku_deploy-0.1.2 vs lib/heroku_deploy/tasks.rb in heroku_deploy-0.1.3

- old
+ new

@@ -148,15 +148,11 @@ puts "Going into maintenance mode" `heroku maintenance:on --app #{app}` puts "Waiting for slug to re-compile..." - 60.times do - sleep 1 - print "." - STDOUT.flush - end + wait_for_maintenance_page( app ) puts "" puts "Pushing to #{app}" `git push git@heroku.com:#{app}.git #{branch}:master` @@ -174,10 +170,11 @@ `heroku maintenance:off --app #{app}` end + def backup( app ) puts "" puts "Beginning Backup" timestamp = Time.now.strftime("%Y%m%d%H%M%S") old_bundle = `heroku bundles --app #{app}`.split.first @@ -191,11 +188,11 @@ while bundle_not_yet_captured?( app ) do print "." STDOUT.flush end puts "" - + if bundle_captured?( app ) puts "New Bundle Ready For Download" `heroku bundles:download backup-#{timestamp} --app #{app}` `mv #{app}.tar.gz #{app}-#{timestamp}.tar.gz` @@ -204,9 +201,16 @@ end puts "Backup Complete!" puts "" + end + + def wait_for_maintenance_page(app) + response_code = 200 + while (response_code != 422) + response_code = HTTParty.get("http://#{app}.heroku.com").code + end end def bundle_not_yet_captured?( app ) `heroku bundles --app #{app}`.include?(" capturing ") end \ No newline at end of file