class Lita::Handlers::RestartElvis
Constants
- BLOG_URL
Public Instance Methods
dyno_info(app_name)
click to toggle source
# File lib/lita/handlers/restart_elvis.rb, line 21 def dyno_info(app_name) infos = heroku.dyno.list(app_name) infos.map { |i| "#{i.fetch('name')}\t#{i.fetch('state')}\tboot time: #{i.fetch('created_at')}" }.join("\n") end
heroku()
click to toggle source
# File lib/lita/handlers/restart_elvis.rb, line 13 def heroku @_heroku ||= PlatformAPI.connect_oauth(ENV.fetch('HEROKU_OAUTH_TOKEN')) end
restart_bot(response)
click to toggle source
# File lib/lita/handlers/restart_elvis.rb, line 27 def restart_bot(response) app_name = ENV.fetch('HEROKU_RESTARTABLE_APP_NAME') response.reply 'Please hold...' restart_dyno_named app_name sleep 5 msg = dyno_info(app_name) response.reply "Done. Status: #{msg}" end
restart_dyno_named(dyno_name)
click to toggle source
# File lib/lita/handlers/restart_elvis.rb, line 17 def restart_dyno_named(dyno_name) result = heroku.dyno.restart_all(dyno_name) end