[60511] contrib/mpbot/port.rb

jmr at macports.org jmr at macports.org
Sat Nov 14 07:08:35 PST 2009


Revision: 60511
          http://trac.macports.org/changeset/60511
Author:   jmr at macports.org
Date:     2009-11-14 07:08:33 -0800 (Sat, 14 Nov 2009)
Log Message:
-----------
mpbot: rewrite herald display logic

Modified Paths:
--------------
    contrib/mpbot/port.rb

Modified: contrib/mpbot/port.rb
===================================================================
--- contrib/mpbot/port.rb	2009-11-14 14:59:38 UTC (rev 60510)
+++ contrib/mpbot/port.rb	2009-11-14 15:08:33 UTC (rev 60511)
@@ -317,29 +317,29 @@
 				portCount = ports.size
 				showMax = 4
 				somePorts = ports.extend(Shuffle).shuffle!.slice(0, showMax)
-				
-				msg = nil;
-				
-				if (portCount == 0) && name
-					msg = "#{nick} is #{name} (#{email})"
-				elsif (portCount == 0)
-					msg = "#{nick} is #{email}"
-				elsif (portCount <= showMax) && name
-					msg = "#{nick} is #{name} (#{email}) and maintainer of " +
-						textEnumeration(somePorts)
-				elsif (portCount <= showMax)
-					msg = "#{nick} is #{email} and maintainer of " +
-						textEnumeration(somePorts)
-				elsif name
-					msg = "#{nick} is #{name} (#{email}) and maintainer of " +
-						textEnumeration(somePorts) +
-						" (of #{portCount} total)"
-				else
-					msg = "#{nick} is #{email} and maintainer of " +
-						textEnumeration(somePorts) +
-						" (of #{portCount} total)"
+
+				msg = "#{nick} is"
+				if name
+				    msg += " #{name}"
 				end
-				
+				if nick != email
+				    if name
+				        msg += " (#{email})"
+				    else
+				        msg += " #{email}"
+				    end
+				end
+
+				if portCount > 0
+				    if name || nick != email
+				        msg +=  " and"
+				    end
+				    msg += " maintainer of " + textEnumeration(somePorts)
+				    if portCount > showMax
+				        msg += " (of #{portCount} total)"
+				    end
+				end
+
 				whereis = whereisNick(nick)
 				if whereis
 					msg = msg + " and #{whereis}"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091114/34b3ec18/attachment.html>


More information about the macports-changes mailing list