Permalink
Browse files

merge from fork origin

  • Loading branch information...
1 parent 20393ba commit 38fa0b6d04a5521ed80d5165a3f7191ab9a95e84 @markomanninen markomanninen committed Nov 23, 2011
Showing with 3,100 additions and 100 deletions.
  1. +27 −0 CHANGELOG.md
  2. +6 −0 bin/hubot
  3. +2 −2 package.json
  4. +55 −0 src/scripts/abstract.coffee
  5. +1 −1 src/scripts/achievement_unlocked.coffee
  6. +30 −0 src/scripts/animal.coffee
  7. +6 −0 src/scripts/bij.coffee
  8. +19 −0 src/scripts/cheer.coffee
  9. +36 −0 src/scripts/chm.coffee
  10. +9 −0 src/scripts/clark.coffee
  11. +24 −0 src/scripts/coderwall.coffee
  12. +10 −0 src/scripts/coin.coffee
  13. +9 −0 src/scripts/commitmessage.coffee
  14. +63 −0 src/scripts/conversation.coffee
  15. +11 −0 src/scripts/cowsay.coffee
  16. +65 −0 src/scripts/deadline.coffee
  17. +27 −0 src/scripts/demolition-man.coffee
  18. +15 −0 src/scripts/destiny.coffee
  19. +46 −0 src/scripts/dialectizer.coffee
  20. +38 −0 src/scripts/dice.coffee
  21. +19 −0 src/scripts/dilbert.coffee
  22. +5 −0 src/scripts/disassemble.coffee
  23. +1 −1 src/scripts/eight-ball.coffee
  24. +26 −0 src/scripts/faceup.coffee
  25. +31 −0 src/scripts/fibonacci.coffee
  26. +9 −0 src/scripts/fortune.coffee
  27. +99 −0 src/scripts/gauges.coffee
  28. +33 −0 src/scripts/getajob.coffee
  29. +37 −0 src/scripts/github-credentials.coffee
  30. +54 −0 src/scripts/google-reader.coffee
  31. +1 −0 src/scripts/haters.coffee
  32. +21 −0 src/scripts/isup.coffee
  33. +34 −0 src/scripts/jenkins.coffee
  34. +150 −0 src/scripts/jira.coffee
  35. +15 −0 src/scripts/jordan.coffee
  36. +62 −0 src/scripts/karma.coffee
  37. +2 −1 src/scripts/keep-alive.coffee
  38. +24 −0 src/scripts/kittens.coffee
  39. +96 −0 src/scripts/list-jira-bugs.coffee
  40. +75 −0 src/scripts/location-decision-maker.coffee
  41. +15 −1 src/scripts/lolz.coffee
  42. +13 −0 src/scripts/look-of-disapproval.coffee
  43. +19 −0 src/scripts/lyrics.coffee
  44. +7 −0 src/scripts/megusta.coffee
  45. +22 −8 src/scripts/meme_generator.coffee
  46. +139 −0 src/scripts/mite.coffee
  47. +18 −0 src/scripts/nettipot.coffee
  48. +43 −0 src/scripts/news.coffee
  49. +21 −0 src/scripts/octocat.coffee
  50. +50 −0 src/scripts/ping.coffee
  51. +28 −0 src/scripts/pivotal.coffee
  52. +34 −0 src/scripts/pivotalstorylisten.coffee
  53. +161 −0 src/scripts/play.coffee
  54. +29 −6 src/scripts/polite.coffee
  55. +20 −0 src/scripts/punchfork.coffee
  56. +45 −0 src/scripts/pypi.coffee
  57. +20 −0 src/scripts/quote.coffee
  58. +1 −0 src/scripts/redis-brain.coffee
  59. 0 src/scripts/remind.coffee
  60. +29 −0 src/scripts/resque.coffee
  61. +15 −0 src/scripts/rimshot.coffee
  62. +29 −0 src/scripts/roll.coffee
  63. +5 −3 src/scripts/rubygems.coffee
  64. +77 −0 src/scripts/salesforce.coffee
  65. +83 −0 src/scripts/script.coffee
  66. +3 −1 src/scripts/shipit.coffee
  67. +16 −0 src/scripts/shorten.coffee
  68. +63 −0 src/scripts/sonos.coffee
  69. +51 −0 src/scripts/sosearch.coffee
  70. +25 −0 src/scripts/store-messages-couchdb.coffee
  71. +81 −0 src/scripts/talkative.coffee
  72. +23 −10 src/scripts/teamcity.coffee
  73. +21 −0 src/scripts/tell.coffee
  74. +60 −0 src/scripts/tvshow.coffee
  75. +9 −0 src/scripts/tweet-content.coffee
  76. +11 −0 src/scripts/twitter.coffee
  77. +7 −0 src/scripts/twss.coffee
  78. +49 −0 src/scripts/uptime-robot.coffee
  79. +36 −0 src/scripts/uptime.coffee
  80. +21 −0 src/scripts/urban.coffee
  81. 0 src/scripts/vanity.coffee
  82. +16 −0 src/scripts/walmart.coffee
  83. +46 −30 src/scripts/weather.coffee
  84. +51 −0 src/scripts/web.coffee
  85. +19 −0 src/scripts/webshot.coffee
  86. +10 −0 src/scripts/whos-turn.coffee
  87. +102 −0 src/scripts/wikipedia.coffee
  88. +5 −4 src/scripts/wolfram.coffee
  89. +67 −0 src/scripts/word-of-the-day.coffee
  90. +58 −24 src/scripts/wordnik.coffee
  91. +0 −6 src/scripts/xkcd.coffee
  92. +31 −0 test/scripts/isup_test.coffee
  93. +3 −2 test/tests.coffee
View
@@ -1,3 +1,30 @@
+v1.1.8
+======
+* allow people to start tracks - Zach Holman <github.com@zachholman.com>
+* simplify local development - atmos
+
+v1.1.7
+======
+* urban dictionary definitions - Kevin Traver <kevintraver@gmail.com>
+* latest tweet from a user - Kevin Traver <kevintraver@gmail.com>
+* bit.ly shortening - Kevin Traver <kevintraver@gmail.com>
+* Hubot Play support - Zach Holman <github.com@zachholman.com>
+* tvshow information - Victor Butler <victorbutler@gmail.com>
+* JIRA issue support - crcastle <crcastle@gmail.com>
+* lulz scripts can lulzbomb now - atmos
+* gaug.es support - Tom Bell <tomb@tombell.org.uk>
+* google reader support - Ben Ubois <ben@benubois.com>
+* faceup script enhancements - Joe Ekiert <joe.ekiert@gmail.com>
+* get a job support - Craig Slusher <cslush@gmail.com>
+* website uptime support - lukesmith <stuff@lukesmith.net>
+* me gusta support - John-Michael Glenn <phyre19@gmail.com>
+* coderwall support - Arlo Carreon <arlo.carreon@gmail.com>
+* cheer me up script - Carl Lerche <me@carllerche.com>
+* google news scripts - Matt McCormick <mbmccormick@gmail.com>
+* various meme generator enhancements - a lot of people :)
+* moar shipit images - Raphael Crawford-Marks <raphael.crawfordmarks@gmail.com>
+
+
v1.1.4
======
* hubot define me - Pete Nicholls <pete@metanation.com>
View
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+npm install
+export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
+
+exec node_modules/.bin/hubot "$@"
View
4 package.json 100755 → 100644
@@ -30,12 +30,12 @@
"underscore": ">= 1.2.1",
"underscore.string": ">= 1.1.6",
"cradle": "0.5.7",
- "clark": "*",
+ "clark": ">= 0.0.3",
"scribe-node": "0.0.20"
},
"directories": {
"lib": "./src"
},
"engine": "node >= 0.4.1 < 0.5.0"
-}
+}
@@ -0,0 +1,55 @@
+# abstract <topic> - Prints a nice abstract of the given topic.
+
+# Copyright (c) 2011 John Tantalo
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+module.exports = (robot) ->
+ robot.respond /(abs|abstract) (.+)/i, (res) ->
+ abstract_url = "http://api.duckduckgo.com/?format=json&q=#{encodeURIComponent(res.match[2])}"
+ res.http(abstract_url)
+ .header('User-Agent', 'Hubot Abstract Script')
+ .get() (err, _, body) ->
+ return res.send "Sorry, the tubes are broken." if err
+ data = JSON.parse(body.toString("utf8"))
+ return unless data
+ topic = data.RelatedTopics[0] if data.RelatedTopics and data.RelatedTopics.length
+ if data.AbstractText
+ # hubot abs numerology
+ # Numerology is any study of the purported mystical relationship between a count or measurement and life.
+ # http://en.wikipedia.org/wiki/Numerology
+ res.send data.AbstractText
+ res.send data.AbstractURL if data.AbstractURL
+ else if topic and not /\/c\//.test(topic.FirstURL)
+ # hubot abs astronomy
+ # Astronomy is the scientific study of celestial objects.
+ # http://duckduckgo.com/Astronomy
+ res.send topic.Text
+ res.send topic.FirstURL
+ else if data.Definition
+ # hubot abs contumacious
+ # contumacious definition: stubbornly disobedient.
+ # http://merriam-webster.com/dictionary/contumacious
+ res.send data.Definition
+ res.send data.DefinitionURL if data.DefinitionURL
+ else
+ res.send "I don't know anything about that."
@@ -4,7 +4,7 @@
module.exports = (robot) ->
robot.hear /achievement (get|unlock(ed)?) (.+?)(\s*[^@\s]+@[^@\s]+)?\s*$/i, (msg) ->
caption = msg.match[3]
- email = msg.match[4]
+ email = msg.match[4] || msg.message.user.email_address
url = "http://achievement-unlocked.heroku.com/xbox/#{escape(caption)}.png"
if email
url += "?email=#{escape(email.trim())}.png"
View
@@ -0,0 +1,30 @@
+# Because animals are animals.
+#
+# animal me - Grab a random gif from http://animalsbeingdicks.com/
+#
+Select = require("soupselect").select
+HtmlParser = require "htmlparser"
+
+module.exports = (robot) ->
+ robot.respond /animal me/i, (msg) ->
+ randimalMe msg, (url) ->
+ msg.send url
+
+randimalMe = (msg, cb) ->
+ msg.http("http://animalsbeingdicks.com/random")
+ .get() (err, res, body) ->
+ console.log res.headers.location
+ animalMe msg, res.headers.location, (location) ->
+ cb location
+
+animalMe = (msg, location, cb) ->
+ msg.http(location)
+ .get() (err, res, body) ->
+ handler = new HtmlParser.DefaultHandler()
+ parser = new HtmlParser.Parser handler
+
+ parser.parseComplete body
+ img = Select handler.dom, "#content .post .entry img"
+
+ console.log img
+ cb img[0].attribs.src
View
@@ -0,0 +1,6 @@
+# EXPERIENCE BIJ
+#
+
+module.exports = (robot) ->
+ robot.hear /bij/i, (msg) ->
+ msg.send "EXPERIENCE BIJ!"
View
@@ -0,0 +1,19 @@
+# Feeling depressed?
+#
+# cheer me up - A little pick me up
+module.exports = (robot) ->
+ robot.respond /cheer me up/i, (msg) ->
+ aww msg
+
+ robot.hear /i( am|'m) emo/i, (msg) ->
+ msg.send "Let me cheer you up."
+ aww msg
+
+aww = (msg) ->
+ msg
+ .http('http://imgur.com/r/aww.json')
+ .get() (err, res, body) ->
+ images = JSON.parse(body)
+ images = images.gallery
+ image = msg.random images
+ msg.send "http://i.imgur.com/#{image.hash}#{image.ext}"
View
@@ -0,0 +1,36 @@
+# Shows a short history lesson of the day from the Computer History Museum.
+#
+# today in computer history|tdih|chm - Displays the content from the This Day in History page on the Computer History Museum site.
+#
+Select = require("soupselect").select
+HtmlParser = require "htmlparser"
+
+module.exports = (robot) ->
+ robot.respond /(today in computer history|tdih|chm)$/i, (msg) ->
+ msg.http("http://www.computerhistory.org/tdih/")
+ .get() (err, res, body) ->
+ handler = new HtmlParser.DefaultHandler()
+ parser = new HtmlParser.Parser handler
+ parser.parseComplete body
+
+ contentEl = Select handler.dom, ".tdihevent p"
+ return unless contentEl
+ msg.send date(handler)
+ msg.send title(contentEl)
+ for sentence in blurbSentences(contentEl)
+ msg.send sentence + '.' if sentence and sentence isnt ""
+
+title = (contentEl) ->
+ trim contentEl[0].children[0].raw
+
+blurbSentences = (contentEl) ->
+ blurb = trim contentEl[1].children[0].raw
+ blurb.split('.')
+
+date = (handler) ->
+ dateEl = Select handler.dom, ".title"
+ return "" unless dateEl
+ trim dateEl[0].children[0].raw
+
+trim = (string) ->
+ return string.replace(/^\s*|\s*$/g, '')
View
@@ -0,0 +1,9 @@
+# clark - build sparklines out of data
+
+clark = require('clark').clark
+
+module.exports = (robot) ->
+ robot.respond /clark (.*)/i, (msg) ->
+ data = msg.match[1].trim().split(' ')
+ msg.send(clark(data))
+
@@ -0,0 +1,24 @@
+# Messing around with the Coderwall API.
+#
+# coderwall <coderwall username> - Returns coder achievements from coderwall.com
+#
+module.exports = (robot) ->
+ robot.respond /(coderwall)( me)? (.*)/i, (msg) ->
+ user = msg.match[3]
+ msg.http("http://coderwall.com/"+user+".json")
+ .get() (err, res, body) ->
+ # If not response bad username
+ if res.headers['content-length'] <= 1
+ letter_s = if user.substr(-1)=='s' then '' else 's'
+ msg.send "Sorry I cannot find "+user+"'"+letter_s+" coderwall"
+ # Else return the coder badges
+ else
+ profile = JSON.parse(body)
+ # Give an intro to the coderwall profile
+ resp_str = "";
+ resp_str += user + "'s coderwall -> http://coderwall.com/"+user + "\n"
+ # Iterate all badges and continue building string
+ profile.badges.forEach (badge) ->
+ resp_str += badge.name + " - " + badge.description + "\n"
+ # Return response
+ msg.send resp_str
View
@@ -0,0 +1,10 @@
+# Help decide between two things
+#
+# throw a coin - Gives you heads or tails
+#
+
+thecoin = ["heads", "tails"]
+
+module.exports = (robot) ->
+ robot.respond /(throw|flip|toss) a coin/i, (msg) ->
+ msg.reply msg.random thecoin
@@ -0,0 +1,9 @@
+# Get a random commit message
+#
+# commit message - Displays a random commit message
+
+module.exports = (robot) ->
+ robot.respond /commit message/i, (msg) ->
+ msg.http("http://whatthecommit.com/index.txt")
+ .get() (err, res, body) ->
+ msg.reply body
@@ -0,0 +1,63 @@
+# Extends robot adding conversation features
+
+
+module.exports = (robot) ->
+ robot.eatListeners = {}
+
+ # Public: Adds a Listener that receives the next message from the user and av
+ # further processing of it.
+ #
+ # user - The user name.
+ # callback - A Function that is called with a Response object. msg.match[1] w
+ # contain the message text without the bot name
+ #
+ # Returns nothing.
+ robot.eatOneResponse = (user, callback) ->
+ robot.eatListeners[user.id] = new Listener(robot, callback)
+
+
+ # Change default receive command, addind processing of eatListeners
+ robot.origReceive = robot.receive
+ robot.receive = (message) ->
+ if robot.eatListeners[message.user.id]?
+ lst = robot.eatListeners[message.user.id]
+ delete robot.eatListeners[message.user.id]
+
+ if lst.call message
+ return
+
+ # Put back to process next message
+ robot.eatListeners[message.user.id] = lst
+
+ robot.origReceive(message)
+
+
+ # Public: Waits for the next message from the current user.
+ #
+ # callback - Called with the user response
+ #
+ # Returns nothing.
+ robot.Response.prototype.waitResponse = (callback) ->
+ robot.eatOneResponse this.message.user, callback
+
+
+
+class Listener
+ constructor: (@robot, @callback) ->
+ if robot.enableSlash
+ @regex = new RegExp("^(?:\/|#{robot.name}:?)\\s*(.*?)\\s*$", 'i')
+ else
+ @regex = new RegExp("^#{robot.name}:?\\s*(.*?)\\s*$", 'i')
+
+ @matcher = (message) =>
+ if message.text?
+ message.text.match @regex
+
+ call: (message) =>
+ if match = @matcher message
+ @callback new @robot.Response(@robot, message, match)
+ return true
+ else
+ return false
+
+
View
@@ -0,0 +1,11 @@
+# Cowsay.
+#
+# cowsay <statement> - Returns a cow that says what you want.
+
+module.exports = (robot) ->
+ robot.respond /cowsay( me)? (.*)/i, (msg) ->
+ msg
+ .http("http://cowsay.morecode.org/say")
+ .query(format: 'text', message: msg.match[2])
+ .get() (err, res, body) ->
+ msg.send body
Oops, something went wrong.

0 comments on commit 38fa0b6

Please sign in to comment.