Skip to content

Instantly share code, notes, and snippets.

@inopinatus
Forked from mutle/gist:1175364
Created August 28, 2011 08:57
Show Gist options
  • Save inopinatus/1176444 to your computer and use it in GitHub Desktop.
Save inopinatus/1176444 to your computer and use it in GitHub Desktop.
no maintenance page unless we're migrating. who needs grep?
# no maint page unless migrations are required
def conditionally_enable_maintenance_page
super if required_downtime_stack?
if c.migrate?
info "~> testing necessity for migrations & maintenance page"
if `cd #{c.release_path} && bundle exec rake db:migrate:status`.scan(/^\s*down/).size > 0
info "~> migrations pending, maintenance page required"
super
else
info "~> no migrations pending, maintenance page not required, migration command cancelled"
@cancel_migrations = true
end
end
end
def migrate
return if @cancel_migrations
super
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment