text: module.exports = function (robot) {
    var awakeMinutes, keepaliveCallback, keepaliveInterval, keepaliveUrl, sleepTime, wakeUpOffset, wakeUpTime
    wakeUpTime = (process.env.HUBOT_HEROKU_WAKEUP_TIME || '6:00').split(':').map(function (i) {
      return parseInt(i, 10)
    })
    sleepTime = (process.env.HUBOT_HEROKU_SLEEP_TIME || '22:00').split(':').map(function (i) {
      return parseInt(i, 10)
    })
    var hoursWakeupTime = 60 * wakeUpTime[0]
    wakeUpOffset = (hoursWakeupTime + wakeUpTime[1]) % (60 * 24)
    var hoursSleepTime = 60 * (sleepTime[0] + 24)
    awakeMinutes = (hoursSleepTime + sleepTime[1] - wakeUpOffset) % (60 * 24)
    keepaliveUrl = process.env.HUBOT_HEROKU_KEEPALIVE_URL || process.env.HEROKU_URL
    if (keepaliveUrl && !keepaliveUrl.match(/\/$/)) {
      keepaliveUrl = keepaliveUrl + '/'
    }
    keepaliveInterval = process.env.HUBOT_HEROKU_KEEPALIVE_INTERVAL != null ? parseFloat(process.env.HUBOT_HEROKU_KEEPALIVE_INTERVAL) : 5
    if (keepaliveUrl == null) {
      robot.logger.error('hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web.url | cut -d= -f2)`')
      return
    }
    if (robot.pingIntervalId) {
      clearInterval(robot.pingIntervalId)
    }
    if (robot.http === null || robot.http === undefined) {
      robot.logger.error('no http function set up')
      return
    }
    if (keepaliveInterval > 0.0) {
      robot.herokuKeepaliveIntervalId = setInterval((function (_this) {
        return function () {
          var client, elapsedMinutes, now
          robot.logger.info('keepalive ping')
          now = new Date()
          var hoursElapsed = 60 * (now.getHours() + 24)
          elapsedMinutes = (hoursElapsed + now.getMinutes() - wakeUpOffset) % (60 * 24)
          if (elapsedMinutes < awakeMinutes) {
            client = robot.http(keepaliveUrl + 'heroku/keepalive')
            if (process.env.EXPRESS_USER && process.env.EXPRESS_PASSWORD) {
              client.auth(process.env.EXPRESS_USER, process.env.EXPRESS_PASSWORD)
            }
            return client.post()(function (err, res, body) {
              if (err != null) {
                robot.logger.info('keepalive pong: ' + err)
                return robot.emit('error', err)
              } else {
                return robot.logger.info('keepalive pong: ' + res.statusCode + ' ' + body)
              }
            })
          } else {
            return robot.logger.info('Skipping keep alive, time to rest')
          }
        }
      })(this), keepaliveInterval * 60 * 1000)
    } else {
      robot.logger.info('hubot-heroku-keepalive is ' + keepaliveInterval + ', so not keeping alive')
    }
    keepaliveCallback = function (req, res) {
      res.set('Content-Type', 'text/plain')
      return res.send('OK')
    }
    robot.router.post('/heroku/keepalive', keepaliveCallback)
    return robot.router.get('/heroku/keepalive', keepaliveCallback)
  }
  
  // ---
  // generated by coffee-script 1.9.2
  