[50137] trunk/base/portmgr/bots/trac.rb

jmr at macports.org jmr at macports.org
Sun Apr 26 03:08:44 PDT 2009


Revision: 50137
          http://trac.macports.org/changeset/50137
Author:   jmr at macports.org
Date:     2009-04-26 03:08:43 -0700 (Sun, 26 Apr 2009)
Log Message:
-----------
add trac plugin for mpbot, thanks anddam

Added Paths:
-----------
    trunk/base/portmgr/bots/trac.rb

Added: trunk/base/portmgr/bots/trac.rb
===================================================================
--- trunk/base/portmgr/bots/trac.rb	                        (rev 0)
+++ trunk/base/portmgr/bots/trac.rb	2009-04-26 10:08:43 UTC (rev 50137)
@@ -0,0 +1,38 @@
+#
+#	trac.rb
+#
+#	Plugin to rbot (http://ruby-rbot.org/), an irc bot, to provide
+#	services related to MacPorts trac systemfor the #macports channel
+#	on freenode.net, created from PortPlugin by James D. Berry
+#
+#	By Andrea D'Amore
+#
+#	$Id: $
+
+require 'stringio'
+
+class TracPlugin < Plugin
+
+	def help(plugin, topic="")
+		case topic
+		  when "ticket"
+			return "ticket <ticket no.> => show http link for ticket # <ticket no.>"
+		  else
+			return "trac commands: ticket"
+		end
+	end
+
+	def ticket(m, params)
+		number = params[:number][/^#?(\d*)$/,1]
+		if ( number )
+			url = "http://trac.macports.org/ticket/"+number
+			m.reply "#{url}"
+		else
+			m.reply "Use either #1234 or 1234 for ticket number"
+		end
+	end
+	
+end
+
+plugin = TracPlugin.new
+plugin.map 'ticket :number', :action => 'ticket'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090426/c734c68d/attachment.html>


More information about the macports-changes mailing list