mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
PluginDownloader: add stepnem's and gsf's repositories; fix issue with non-root path
This commit is contained in:
parent
f18429fdf7
commit
72600e54af
@ -150,6 +150,7 @@ class GithubRepository(GitRepository):
|
||||
if file.name.startswith(prefix + dirname):
|
||||
extractedFile = archive.extractfile(file)
|
||||
newFileName = os.path.join(*file.name.split('/')[1:])
|
||||
newFileName = newFileName[len(self._path)-1:]
|
||||
newFileName = os.path.join(directory, newFileName)
|
||||
if extractedFile is None:
|
||||
os.mkdir(newFileName)
|
||||
@ -157,6 +158,8 @@ class GithubRepository(GitRepository):
|
||||
open(newFileName, 'a').write(extractedFile.read())
|
||||
finally:
|
||||
archive.close()
|
||||
fileObject2.close()
|
||||
del archive, fileObject, fileObject2
|
||||
|
||||
def _getWritableDirectoryFromList(self, directories):
|
||||
for directory in directories:
|
||||
@ -166,10 +169,32 @@ class GithubRepository(GitRepository):
|
||||
|
||||
|
||||
repositories = {
|
||||
'ProgVal': GithubRepository('ProgVal', 'Supybot-plugins'),
|
||||
'ProgVal': GithubRepository(
|
||||
'ProgVal',
|
||||
'Supybot-plugins'
|
||||
),
|
||||
'quantumlemur': GithubRepository(
|
||||
'quantumlemur',
|
||||
'Supybot-plugins'
|
||||
'Supybot-plugins',
|
||||
),
|
||||
'stepnem': GithubRepository(
|
||||
'stepnem',
|
||||
'supybot-plugins',
|
||||
),
|
||||
'gsf-snapshot': GithubRepository(
|
||||
'gsf',
|
||||
'supybot-plugins',
|
||||
'Supybot-plugins-20060723',
|
||||
),
|
||||
'gsf-edsu': GithubRepository(
|
||||
'gsf',
|
||||
'supybot-plugins',
|
||||
'edsu-plugins',
|
||||
),
|
||||
'gsf': GithubRepository(
|
||||
'gsf',
|
||||
'supybot-plugins',
|
||||
'plugins',
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -53,25 +53,46 @@ class PluginDownloaderTestCase(PluginTestCase):
|
||||
finally:
|
||||
PluginTestCase.tearDown(self)
|
||||
|
||||
def _testPluginInstalled(self, name):
|
||||
assert os.path.isdir(pluginsPath + '/%s/' % name)
|
||||
assert os.path.isfile(pluginsPath + '/%s/plugin.py' % name)
|
||||
assert os.path.isfile(pluginsPath + '/%s/config.py' % name)
|
||||
|
||||
def testRepolist(self):
|
||||
self.assertResponse('repolist', 'quantumlemur, ProgVal')
|
||||
self.assertRegexp('repolist', '(.*, )?ProgVal(, .*)?')
|
||||
self.assertRegexp('repolist', '(.*, )?quantumlemur(, .*)?')
|
||||
self.assertRegexp('repolist ProgVal', '(.*, )?AttackProtector(, .*)?')
|
||||
|
||||
def testInstallProgVal(self):
|
||||
self.assertError('plugindownloader install ProgVal Listener')
|
||||
self.assertNotError('plugindownloader install ProgVal AttackProtector')
|
||||
self.assertError('plugindownloader install ProgVal Listener')
|
||||
assert os.path.isdir(pluginsPath + '/AttackProtector/')
|
||||
assert os.path.isfile(pluginsPath + '/AttackProtector/plugin.py')
|
||||
assert os.path.isfile(pluginsPath + '/AttackProtector/config.py')
|
||||
self._testPluginInstalled('AttackProtector')
|
||||
|
||||
def testInstallQuantumlemur(self):
|
||||
self.assertError('plugindownloader install quantumlemur AttackProtector')
|
||||
self.assertNotError('plugindownloader install quantumlemur Listener')
|
||||
self.assertError('plugindownloader install quantumlemur AttackProtector')
|
||||
assert os.path.isdir(pluginsPath + '/Listener/')
|
||||
assert os.path.isfile(pluginsPath + '/Listener/plugin.py')
|
||||
assert os.path.isfile(pluginsPath + '/Listener/config.py')
|
||||
self._testPluginInstalled('Listener')
|
||||
|
||||
def testInstallStepnem(self):
|
||||
self.assertNotError('plugindownloader install stepnem Freenode')
|
||||
self._testPluginInstalled('Freenode')
|
||||
|
||||
def testGsf(self):
|
||||
self.assertNotError('plugindownloader install gsf-snapshot Debian')
|
||||
self._testPluginInstalled('Debian')
|
||||
self.assertError('plugindownloader install gsf-snapshot Anagram')
|
||||
self.assertError('plugindownloader install gsf-snapshot Acronym')
|
||||
|
||||
self.assertNotError('plugindownloader install gsf-edsu Anagram')
|
||||
self._testPluginInstalled('Anagram')
|
||||
self.assertError('plugindownloader install gsf-edsu Debian')
|
||||
self.assertError('plugindownloader install gsf-edsu Acronym')
|
||||
|
||||
self.assertNotError('plugindownloader install gsf Acronym')
|
||||
self._testPluginInstalled('Acronym')
|
||||
self.assertError('plugindownloader install gsf Anagram')
|
||||
self.assertError('plugindownloader install gsf Debian')
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
Loading…
Reference in New Issue
Block a user