Changeset 60993 in webkit
- Timestamp:
- Jun 10, 2010 11:56:31 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r60988 r60993 1 2010-06-10 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Daniel Bates. 4 5 Make SheriffBot more chatty 6 https://bugs.webkit.org/show_bug.cgi?id=40463 7 8 People seem to like to talk to SheriffBot, so let's make him chat back. 9 10 * Scripts/webkitpy/thirdparty/__init__.py: 11 * Scripts/webkitpy/tool/bot/irc_command.py: 12 * Scripts/webkitpy/tool/bot/irc_command_unittest.py: Added. 13 * Scripts/webkitpy/tool/bot/sheriffircbot.py: 14 * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py: 15 1 16 2010-06-10 Brian Weinstein <bweinstein@apple.com> 2 17 -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py
r60876 r60993 72 72 installer.install(url="http://pypi.python.org/packages/source/p/pep8/pep8-0.5.0.tar.gz#md5=512a818af9979290cd619cce8e9c2e2b", 73 73 url_subpath="pep8-0.5.0/pep8.py") 74 74 installer.install(url="http://www.adambarth.com/webkit/eliza", 75 target_name="eliza.py") 75 76 76 77 rietveld_dir = os.path.join(autoinstalled_dir, "rietveld") -
trunk/WebKitTools/Scripts/webkitpy/tool/bot/irc_command.py
r57948 r60993 76 76 77 77 78 class Help(IRCCommand): 79 def execute(self, nick, args, tool, sheriff): 80 return "%s: Available commands: %s" % (nick, ", ".join(commands.keys())) 81 82 78 83 class Hi(IRCCommand): 79 84 def execute(self, nick, args, tool, sheriff): … … 81 86 quips.append('"Only you can prevent forest fires." -- Smokey the Bear') 82 87 return random.choice(quips) 88 89 90 class Eliza(IRCCommand): 91 therapist = None 92 93 def __init__(self): 94 if not self.therapist: 95 import webkitpy.thirdparty.autoinstalled.eliza as eliza 96 Eliza.therapist = eliza.eliza() 97 98 def execute(self, nick, args, tool, sheriff): 99 return "%s: %s" % (nick, self.therapist.respond(" ".join(args))) 100 101 102 # FIXME: Lame. We should have an auto-registering CommandCenter. 103 commands = { 104 "last-green-revision": LastGreenRevision, 105 "restart": Restart, 106 "rollout": Rollout, 107 "help": Help, 108 "hi": Hi, 109 } -
trunk/WebKitTools/Scripts/webkitpy/tool/bot/sheriffircbot.py
r56977 r60993 53 53 54 54 class SheriffIRCBot(object): 55 # FIXME: Lame. We should have an auto-registering CommandCenter.56 commands = {57 "last-green-revision": irc_command.LastGreenRevision,58 "restart": irc_command.Restart,59 "rollout": irc_command.Rollout,60 "hi": irc_command.Hi,61 }62 63 55 def __init__(self, tool, sheriff): 64 56 self._tool = tool … … 76 68 if not tokenized_request: 77 69 return 78 command = self.commands.get(tokenized_request[0]) 70 command = irc_command.commands.get(tokenized_request[0]) 71 args = tokenized_request[1:] 79 72 if not command: 80 self._tool.irc().post("%s: Available commands: %s" % ( 81 nick, ", ".join(self.commands.keys()))) 82 return 83 response = command().execute(nick, 84 tokenized_request[1:], 85 self._tool, 86 self._sheriff) 73 # Give the peoples someone to talk with. 74 command = irc_command.Eliza 75 args = tokenized_request 76 response = command().execute(nick, args, self._tool, self._sheriff) 87 77 if response: 88 78 self._tool.irc().post(response) -
trunk/WebKitTools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py
r57948 r60993 51 51 OutputCapture().assert_outputs(self, run, args=["hi"], expected_stderr=expected_stderr) 52 52 53 def test_ bogus(self):54 expected_stderr = "MOCK: irc.post: mock_nick: Available commands: rollout, hi, restart, last-green-revision\n"55 OutputCapture().assert_outputs(self, run, args=[" bogus"], expected_stderr=expected_stderr)53 def test_help(self): 54 expected_stderr = "MOCK: irc.post: mock_nick: Available commands: rollout, hi, help, restart, last-green-revision\n" 55 OutputCapture().assert_outputs(self, run, args=["help"], expected_stderr=expected_stderr) 56 56 57 57 def test_lgr(self):
Note: See TracChangeset
for help on using the changeset viewer.