Added a configure() question about aliasing sf to Sourceforge. Updated the

snarfer configurables so that they default to off and made the configure()
question available to all users. Updated the snarfer tests to ensure the
snarfer configurable is true before starting the tests.
This commit is contained in:
James Vega 2003-11-17 18:10:53 +00:00
parent 31c05776c6
commit 8dbaae1d37
2 changed files with 14 additions and 8 deletions

View File

@ -55,13 +55,12 @@ def configure(onStart, afterConnect, advanced):
# commands you would like to be run when the bot has finished connecting. # commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
onStart.append('load Sourceforge') onStart.append('load Sourceforge')
if advanced: print 'The Sourceforge plugin has the functionality to watch for URLs'
print 'The Sourceforge plugin has the functionality to watch for URLs' print 'that match a specific pattern (we call this a snarfer). When'
print 'that match a specific pattern (we call this a snarfer). When' print 'supybot sees such a URL, he will parse the web page for'
print 'supybot sees such a URL, he will parse the web page for' print 'information and reply with the results.\n'
print 'information and reply with the results.\n' if yn('Do you want the Sourceforge snarfer enabled by default?') == 'y':
if yn('Do you want the Sourceforge snarfer enabled by default?') =='n': onStart.append('Sourceforge config tracker-snarfer on')
onStart.append('Sourceforge config tracker-snarfer off')
print 'The bugs and rfes commands of the Sourceforge plugin can be set' print 'The bugs and rfes commands of the Sourceforge plugin can be set'
print 'to query a default project when no project is specified. If this' print 'to query a default project when no project is specified. If this'
@ -74,6 +73,12 @@ def configure(onStart, afterConnect, advanced):
if project: if project:
onStart.append('Sourceforge config defaultproject %s' % project) onStart.append('Sourceforge config defaultproject %s' % project)
if yn('Would you like to setup sf as an alias to Sourceforge?') == 'y':
if 'load Alias' not in onStart:
print 'This depends on the Alias module.'
if yn('Would you like to load the Alias plugin now?') == 'y':
onStart.append('load Alias')
class TrackerError(Exception): class TrackerError(Exception):
pass pass
@ -98,7 +103,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
_res =(_resolution, _assigned, _submitted, _priority, _status) _res =(_resolution, _assigned, _submitted, _priority, _status)
configurables = plugins.ConfigurableDictionary( configurables = plugins.ConfigurableDictionary(
[('tracker-snarfer', plugins.ConfigurableBoolType, True, [('tracker-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the bot will reply to SF.net Tracker URLs in """Determines whether the bot will reply to SF.net Tracker URLs in
the channel with a nice summary of the tracker item."""), the channel with a nice summary of the tracker item."""),
('default-project', plugins.ConfigurableStrType, '', ('default-project', plugins.ConfigurableStrType, '',

View File

@ -81,6 +81,7 @@ class SourceforgeTest(ChannelPluginTestCase, PluginDocumentation):
def testSnarfer(self): def testSnarfer(self):
s = r'.*Status.*: \w+' s = r'.*Status.*: \w+'
self.assertNotError('config tracker-snarfer on')
self.assertRegexp('http://sourceforge.net/tracker/index.php?' self.assertRegexp('http://sourceforge.net/tracker/index.php?'
'func=detail&aid=589953&group_id=58965&atid=489447', 'func=detail&aid=589953&group_id=58965&atid=489447',
s) s)