lib/heroku_deploy/tasks.rb in heroku_deploy-0.1.8 vs lib/heroku_deploy/tasks.rb in heroku_deploy-0.1.9
- old
+ new
@@ -148,11 +148,11 @@
puts "Going into maintenance mode"
`heroku maintenance:on --app #{app}`
print "Waiting for slug to re-compile..."
- wait_for_maintenance_page( app )
+ wait_for_maintenance_on( app )
puts ""
puts "Pushing to #{app}"
`git push git@heroku.com:#{app}.git #{branch}:master`
@@ -168,10 +168,13 @@
puts "Getting out of maintenance mode"
`heroku maintenance:off --app #{app}`
+ print "Waiting for app to go live..."
+ wait_for_maintenance_off(app)
+ puts ""
end
def backup( app )
puts ""
puts "Beginning Backup"
@@ -202,13 +205,26 @@
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
+ def maintenance_off(app)
+ HTTParty.get("http://#{app}.heroku.com").code != 422
+ end
+
+ def wait_for_maintenance_on(app)
+ while (maintenance_off(app))
+ print "."
+ STDOUT.flush
+ end
+ end
+
+ def maintenance_on(app)
+ HTTParty.get("http://#{app}.heroku.com").code != 200
+ end
+
+ def wait_for_maintenance_off(app)
+ while (maintenance_on(app))
print "."
STDOUT.flush
end
end
\ No newline at end of file