Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (31 sloc) 0.909 kb
# Description:
# Whois for gems, because gem names are like domains in the 90's
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot gem whois <gemname> - returns gem details if it exists
#
# Author:
# jonmagic
module.exports = (robot) ->
robot.respond /gem whois (.*)/i, (msg) ->
gemname = escape(msg.match[1])
msg.http("http://rubygems.org/api/v1/gems/#{gemname}.json")
.get() (err, res, body) ->
try
json = JSON.parse(body)
msg.send " gem name: #{json.name}\n
owners: #{json.authors}\n
info: #{json.info}\n
version: #{json.version}\n
downloads: #{json.downloads}\n
homepage: #{json.homepage_uri}\n
documentation: #{json.documentation_uri}\n
source code: #{json.source_code_uri}\n"
catch err
msg.send "Gem not found. It will be mine. Oh yes. It will be mine. *sinister laugh*"
Jump to Line
Something went wrong with that request. Please try again.