From Abrupt Curlew, 8 Years ago, written in Diff-output.
Embed
  1. diff --git a/scripts/lunar.coffee b/scripts/lunar.coffee
  2. index 3d35c9f..3d666c7 100644
  3. --- a/scripts/lunar.coffee
  4. +++ b/scripts/lunar.coffee
  5. @@ -27,6 +27,7 @@ amqplib = require 'amqp'
  6.  api_key = process.env.HUBOT_PASTE_API_KEY
  7.  channel = process.env.HUBOT_PASTE_CHANNEL
  8.  lvu_pattern = 'what|where|website|sources|maintainer|version'
  9. +lvu_gh_pat = 'DETAILS|DEPENDS|CONFIGURE|CONFLICTS|INSTALL|PRE_BUILD|BUILD|POST_BUILD|POST_INSTALL|PRE_REMOVE|POST_REMOVE'
  10.  amqp_url = process.env.HUBOT_RMQ_URL
  11.  
  12.  responses = [
  13. @@ -97,6 +98,19 @@ module.exports = (robot) ->
  14.      output.stdout.on 'data', (data) ->
  15.        msg.reply data.toString().replace(/\n/g, " ")
  16.  
  17. +  robot.hear new RegExp('^!lvu (' + lvu_gh_pat + ')($|\\s+[-\\w]+)', 'i'), (msg) ->
  18. +    module = msg.match[2].replace /^\s+|\s+$/g, ""
  19. +    output = spawn "/bin/lvu", ["where", module]
  20. +
  21. +    file = msg.match[1]
  22. +
  23. +    output.stderr.on 'data', (data) ->
  24. +      if data.toString().match /Unable to find/i
  25. +        msg.reply "Module #{module} not found."
  26. +        return
  27. +    output.stdout.on 'data', (data) ->
  28. +      msg.reply "https://github.com/lunar-linux/moonbase-" + data.toString().replace(/\//, "/blob/master/") + "/" + module + "/" + file
  29. +
  30.    robot.hear /^!paste$/, (msg) ->
  31.      msg.reply "http://devnull.lunar-linux.org"
  32.  
  33.