|
|
@@ -0,0 +1,21 @@ |
|
|
|
import codearchiver.core |
|
|
|
import codearchiver.modules.git |
|
|
|
import datetime |
|
|
|
import re |
|
|
|
|
|
|
|
|
|
|
|
class GitHubModule(codearchiver.core.Module): |
|
|
|
name = 'github' |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def matches(inputUrl): |
|
|
|
return bool(re.match(r'^https?://(www\.)?github\.com/[^/]+/[^/]+(?<!\.git)$', inputUrl.url)) |
|
|
|
|
|
|
|
def process(self): |
|
|
|
result = codearchiver.core.Result(id = f'github_{"_".join(self._url.split("/")[3:])}_{datetime.datetime.utcnow():%Y%m%dT%H%M%SZ}') |
|
|
|
|
|
|
|
gitModule = codearchiver.modules.git.Git(codearchiver.core.InputURL(f'{self._url}.git'), id_ = f'{result.id}_git') |
|
|
|
gitModuleResult = gitModule.process() |
|
|
|
result.submoduleResults.append((gitModule, gitModuleResult)) |
|
|
|
|
|
|
|
return result |