Skip to content

Instantly share code, notes, and snippets.

@mutle
Created August 27, 2011 13:03
Show Gist options
  • Save mutle/1175364 to your computer and use it in GitHub Desktop.
Save mutle/1175364 to your computer and use it in GitHub Desktop.
# no maint page unless migrations are required
def conditionally_enable_maintenance_page
if c.migrate?
info "~> testing necessity for migrations & maintenance page"
if `cd #{c.release_path} && bundle exec rake db:migrate:status | grep down | wc -l`.to_i > 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