lib/heroku_deploy/tasks.rb in heroku_deploy-0.0.10 vs lib/heroku_deploy/tasks.rb in heroku_deploy-0.0.11
- old
+ new
@@ -45,15 +45,17 @@
puts ""
puts "Creating #{staging_app} Heroku app"
puts ""
`heroku app:create #{staging_app}`
+ `heroku addons:add bundles:single --app #{staging_app}`
puts ""
puts "Creating #{production_app} Heroku app"
puts ""
`heroku app:create #{production_app}`
+ `heroku addons:add bundles:single --app #{production_app}`
puts ""
puts "Setup Complete!"
puts ""
@@ -149,21 +151,35 @@
`heroku bundles:destroy #{old_bundle} --app #{app}`
puts "Old Bundle Destroyed"
`heroku bundles:capture backup-#{timestamp} --app #{app}`
puts "New Bundle Captured on Heroku: backup-#{timestamp}"
- while !`heroku bundles --app #{app}`.include?("complete") do
+ puts "Waiting for Bundle to become available..."
+ while bundle_not_yet_captured?( app ) do
+ print "."
end
- puts "New Bundle Ready For Download"
+ 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`
+ `heroku bundles:download backup-#{timestamp} --app #{app}`
+ `mv #{app}.tar.gz #{app}-#{timestamp}.tar.gz`
- puts "New Bundle Downloaded: #{app}-#{timestamp}.tar.gz"
-
+ puts "New Bundle Downloaded: #{app}-#{timestamp}.tar.gz"
+ end
+
puts "Backup Complete!"
puts ""
+ end
+
+ protected
+
+ def bundle_not_yet_captured?( app )
+ `heroku bundles --app #{app}`.include?(" capturing ")
+ end
+
+ def bundle_captured?( app )
+ `heroku bundles --app #{app}`.include?(" complete ")
end
end
\ No newline at end of file