A VCS repository archival tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
675 B

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