class Takeoff::Stage::Heroku::EnableMaintenanceMode

Public Instance Methods

call(env) click to toggle source
# File lib/takeoff/stage/heroku/enable_maintenance_mode.rb, line 7
def call(env)
  unless env[:dangerous]
    log "Skipping maintenance mode because nothing dangerous is going on"
    
    return @app.call(env) 
  end

  log     "Enabling maintenance mode"
  execute "heroku maintenance:on --remote #{env[:server_remote]}"

  begin
    @app.call(env)
  ensure
    log     "Disabling maintenance mode"
    execute "heroku maintenance:off --remote #{env[:server_remote]}"
  end
end