<commit_before># Show status of 3 most recent builds.
#
# You need to set the following variables:
# HUBOT_TEAMCITY_USERNAME = <user name>
# HUBOT_TEAMCITY_PASSWORD = <password>
# HUBOT_TEAMCITY_HOSTNAME = <host : port>
#
# show me builds -- Show status of currently running builds
module.exports = (robot) ->
  robot.respond /show (me )?builds/i, (msg) ->
    username = process.env.HUBOT_TEAMCITY_USERNAME
    password = <PASSWORD>
    hostname = process.env.HUBOT_TEAMCITY_HOSTNAME
    msg.http("http://#{hostname}/app/rest/builds")
      .query(locator: ["running:any", "count:3"].join(","))
      .headers(Authorization: "Basic #{new Buffer("#{username}:#{password}").toString("base64")}", Accept: "application/json")
      .get() (err, res, body) ->
        if err
          msg.send "Team city says: #{err}"
          return
        # Sort by build number.
        builds = JSON.parse(body).build.sort((a, b)-> parseInt(b.number) - parseInt(a.number))
        for build in builds
          if build.running
            started = Date.parse(build.startDate.replace(/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})([+\-]\d{4})/, "$1-$2-$3T$4:$5:$6$7"))
            elapsed = (Date.now() - started) / 1000
            seconds = "" + Math.floor(elapsed % 60)
            seconds = "0#{seconds}" if seconds.length < 2
            msg.send "#{build.number}, #{build.percentageComplete}% complete, #{Math.floor(elapsed / 60)}:#{seconds} minutes"
          else if build.status is "SUCCESS"
            msg.send "#{build.number} is full of win"
          else if build.status is "FAILUED"
            msg.send "#{build.number} is #fail"<commit_msg>Displays the project name the the build belongs to<commit_after># Show status of 3 most recent builds.
#
# You need to set the following variables:
# HUBOT_TEAMCITY_USERNAME = <user name>
# HUBOT_TEAMCITY_PASSWORD = <password>
# HUBOT_TEAMCITY_HOSTNAME = <host : port>
#
# show me builds -- Show status of currently running builds
module.exports = (robot) ->
  robot.respond /show (me )?builds/i, (msg) ->
    username = process.env.HUBOT_TEAMCITY_USERNAME
    password = <PASSWORD>
    hostname = process.env.HUBOT_TEAMCITY_HOSTNAME
    msg.http("http://#{hostname}/app/rest/builds")
      .query(locator: ["running:any", "count:3"].join(","))
      .headers(Authorization: "Basic #{new Buffer("#{username}:#{password}").toString("base64")}", Accept: "application/json")
      .get() (err, res, body) ->
        if err
          msg.send "Team city says: #{err}"
          return
        # Sort by build number.
        builds = JSON.parse(body).build.sort((a, b)-> parseInt(b.number) - parseInt(a.number))
        for build in builds
          msg.http("http://#{hostname}#{build.href}")
            .headers(Authorization: "Basic #{new Buffer("#{username}:#{password}").toString("base64")}", Accept: "application/json")
            .get() (err, res, body) ->
              if err
                msg.send "Team city says: #{err}"
                return

              project = JSON.parse(body)

              if build.running
                started = Date.parse(build.startDate.replace(/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})([+\-]\d{4})/, "$1-$2-$3T$4:$5:$6$7"))
                elapsed = (Date.now() - started) / 1000
                seconds = "" + Math.floor(elapsed % 60)
                seconds = "0#{seconds}" if seconds.length < 2
                msg.send "#{project.buildType.projectName} - #{build.number}, #{build.percentageComplete}% complete, #{Math.floor(elapsed / 60)}:#{seconds} minutes"
              else if build.status is "SUCCESS"
                msg.send "#{project.buildType.projectName} - #{build.number} is full of win"
              else if build.status is "FAILUED"
                msg.send "#{project.buildType.projectName} - #{build.number} is #fail"
{'fraction_non_alphanumeric': 0.17149569303054032, 'fraction_numerical': 0.015139650221874185, 'mean_word_length': 2.6634799235181643, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1851992', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1233, 'n_words': 279}