Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

There's a gem for that!

  • Loading branch information...
commit f51e07316687c6091c90f4414e4347d17a0b4e41 1 parent 90db40d
@sferik sferik authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/scripts/rubygems.coffee
View
14 src/scripts/rubygems.coffee
@@ -0,0 +1,14 @@
+# Find a rubygem from rubygems.org
+#
+# hubot <there's a gem for> that - Returns a link to a gem on rubygems.org
+#
+
+module.exports = (robot) ->
+ robot.respond /there's a gem for (.*)/i, (msg) ->
+ search = escape(msg.match[1])
+ msg.http('https://rubygems.org/api/v1/search.json')
+ .query(query: search)
+ .get() (err, res, body) ->
+ results = JSON.parse(body)
+ result = results[0]
+ msg.send "https://rubygems.org/gems/#{result.name}"

0 comments on commit f51e073

Please sign in to comment.
Something went wrong with that request. Please try again.