From cb99cd808a61b4f19db839bead28f3067150a8f6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 12 Aug 2019 00:56:55 +0300 Subject: rename source files --- pull/definitions.py | 72 ----------------------------------------------------- pull/my_repos.py | 57 ++++++++++++++++++++++++++++++++++++++++++ pull/pull.py | 2 +- pull/registry.py | 57 ------------------------------------------ pull/repo.py | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 130 deletions(-) delete mode 100644 pull/definitions.py create mode 100644 pull/my_repos.py delete mode 100644 pull/registry.py create mode 100644 pull/repo.py diff --git a/pull/definitions.py b/pull/definitions.py deleted file mode 100644 index 43b55e4..0000000 --- a/pull/definitions.py +++ /dev/null @@ -1,72 +0,0 @@ -import os.path - - -DEFAULT_OWNER = 'Egor Tensin' -DEFAULT_GITHUB_USER = 'egor-tensin' -DEFAULT_BITBUCKET_USER = 'egor-tensin' - - -class Repo: - @staticmethod - def extract_repo_name(repo_id): - return os.path.basename(repo_id) - - def __init__(self, repo_id, clone_url, owner=None, desc=None, - homepage=None): - self.repo_id = repo_id - self.repo_name = self.extract_repo_name(repo_id) - self.clone_url = clone_url - if owner is None: - owner = DEFAULT_OWNER - self.owner = owner - if desc is None: - if homepage is not None: - desc = homepage - elif clone_url is not None: - desc = clone_url - else: - desc = self.repo_name - self.desc = desc - self.homepage = homepage - - -class GithubRepo(Repo): - def __init__(self, repo_id, clone_url=None, owner=None, desc=None, - homepage=None, github_user=DEFAULT_GITHUB_USER): - if clone_url is None: - clone_url = self.build_clone_url(github_user, repo_id) - if homepage is None: - homepage = self.build_homepage_url(github_user, repo_id) - super().__init__(repo_id, clone_url, owner=owner, desc=desc, - homepage=homepage) - - @staticmethod - def build_clone_url(user, repo_id): - name = Repo.extract_repo_name(repo_id) - return f'ssh://git@github.com/{user}/{name}.git' - - @staticmethod - def build_homepage_url(user, repo_id): - name = Repo.extract_repo_name(repo_id) - return f'https://github.com/{user}/{name}' - - -class BitbucketRepo(Repo): - def __init__(self, repo_id, clone_url=None, owner=None, desc=None, - homepage=None, bitbucket_user=DEFAULT_BITBUCKET_USER): - if clone_url is None: - clone_url = self.build_clone_url(bitbucket_user, repo_id) - if homepage is None: - homepage = self.build_homepage_url(bitbucket_user, repo_id) - super().__init__(repo_id, clone_url, owner=owner, desc=desc, - homepage=homepage) - - @staticmethod - def build_clone_url(user, repo_id): - name = Repo.extract_repo_name(repo_id) - return f'ssh://git@bitbucket.org/{user}/{name}.git' - - @staticmethod - def build_homepage_url(user, repo_id): - name = Repo.extract_repo_name(repo_id) - return f'https://bitbucket.org/{user}/{name.lower()}' diff --git a/pull/my_repos.py b/pull/my_repos.py new file mode 100644 index 0000000..0913cd6 --- /dev/null +++ b/pull/my_repos.py @@ -0,0 +1,57 @@ +from pull.repo import BitbucketRepo, GithubRepo, Repo + + +MY_REPOS = ( + GithubRepo('personal/aes-tools'), + GithubRepo('personal/blog'), + GithubRepo('personal/chess-games'), + GithubRepo('personal/cmake-common'), + GithubRepo('personal/config-links'), + GithubRepo('personal/cv'), + GithubRepo('personal/egor-tensin.github.io'), + GithubRepo('personal/filters'), + GithubRepo('personal/linux-home'), + GithubRepo('personal/linux-status'), + GithubRepo('personal/notes'), + GithubRepo('personal/pdb-repo'), + GithubRepo('personal/privilege-check'), + GithubRepo('personal/simple-interpreter'), + GithubRepo('personal/sorting-algorithms'), + GithubRepo('personal/vk-scripts'), + GithubRepo('personal/windows-env'), + GithubRepo('personal/windows-home'), + GithubRepo('personal/windows-tmp'), + GithubRepo('personal/windows7-drivers'), + GithubRepo('personal/writable-dirs'), + + BitbucketRepo('etc/etc-tensin-laptop1'), + BitbucketRepo('etc/etc-tensin-laptop2'), + BitbucketRepo('etc/etc-tensin-pc1'), + BitbucketRepo('etc/etc-tensin-raspi1'), + BitbucketRepo('etc/etc-tensin-raspi2'), + BitbucketRepo('fr24/fr24-cover-letter'), + BitbucketRepo('fr24/fr24-home'), + BitbucketRepo('fr24/fr24-tmp'), + BitbucketRepo('netwrix/etc-wiki'), + BitbucketRepo('netwrix/netwrix-copyright'), + BitbucketRepo('netwrix/netwrix-lab'), + BitbucketRepo('netwrix/netwrix-logs'), + #BitbucketRepo('netwrix/netwrix-webapi'), + BitbucketRepo('netwrix/netwrix-xml'), + BitbucketRepo('netwrix/netwrix.sh'), + BitbucketRepo('netwrix/wiki-backup'), + BitbucketRepo('shadow'), + BitbucketRepo('staging/361_Tensin_E_D_report'), + BitbucketRepo('staging/361_Tensin_E_D_slides'), + BitbucketRepo('staging/461_Tensin_E_D_report'), + BitbucketRepo('staging/461_Tensin_E_D_slides'), + BitbucketRepo('staging/cgit-repos'), + BitbucketRepo('staging/deposit-calculator'), + BitbucketRepo('staging/raspi-temp-client'), + BitbucketRepo('staging/raspi-temp-server'), + BitbucketRepo('staging/x64-decoder'), + + Repo('fr24/key_mgmt', 'ssh://egor@tensin-raspi2.home/~/tmp/key_mgmt.git'), + Repo('fr24/openfortivpn', 'ssh://egor@tensin-raspi2.home/~/tmp/openfortivpn.git'), + Repo('staging/upload-shadow', 'ssh://egor@tensin-raspi2.home/~/tmp/upload-shadow.git'), +) diff --git a/pull/pull.py b/pull/pull.py index 97441fa..115be5b 100644 --- a/pull/pull.py +++ b/pull/pull.py @@ -9,7 +9,7 @@ import socket import sys import subprocess -from pull.registry import MY_REPOS +from pull.my_repos import MY_REPOS env = os.environ.copy() diff --git a/pull/registry.py b/pull/registry.py deleted file mode 100644 index 822f6dc..0000000 --- a/pull/registry.py +++ /dev/null @@ -1,57 +0,0 @@ -from pull.definitions import BitbucketRepo, GithubRepo, Repo - - -MY_REPOS = ( - GithubRepo('personal/aes-tools'), - GithubRepo('personal/blog'), - GithubRepo('personal/chess-games'), - GithubRepo('personal/cmake-common'), - GithubRepo('personal/config-links'), - GithubRepo('personal/cv'), - GithubRepo('personal/egor-tensin.github.io'), - GithubRepo('personal/filters'), - GithubRepo('personal/linux-home'), - GithubRepo('personal/linux-status'), - GithubRepo('personal/notes'), - GithubRepo('personal/pdb-repo'), - GithubRepo('personal/privilege-check'), - GithubRepo('personal/simple-interpreter'), - GithubRepo('personal/sorting-algorithms'), - GithubRepo('personal/vk-scripts'), - GithubRepo('personal/windows-env'), - GithubRepo('personal/windows-home'), - GithubRepo('personal/windows-tmp'), - GithubRepo('personal/windows7-drivers'), - GithubRepo('personal/writable-dirs'), - - BitbucketRepo('etc/etc-tensin-laptop1'), - BitbucketRepo('etc/etc-tensin-laptop2'), - BitbucketRepo('etc/etc-tensin-pc1'), - BitbucketRepo('etc/etc-tensin-raspi1'), - BitbucketRepo('etc/etc-tensin-raspi2'), - BitbucketRepo('fr24/fr24-cover-letter'), - BitbucketRepo('fr24/fr24-home'), - BitbucketRepo('fr24/fr24-tmp'), - BitbucketRepo('netwrix/etc-wiki'), - BitbucketRepo('netwrix/netwrix-copyright'), - BitbucketRepo('netwrix/netwrix-lab'), - BitbucketRepo('netwrix/netwrix-logs'), - #BitbucketRepo('netwrix/netwrix-webapi'), - BitbucketRepo('netwrix/netwrix-xml'), - BitbucketRepo('netwrix/netwrix.sh'), - BitbucketRepo('netwrix/wiki-backup'), - BitbucketRepo('shadow'), - BitbucketRepo('staging/361_Tensin_E_D_report'), - BitbucketRepo('staging/361_Tensin_E_D_slides'), - BitbucketRepo('staging/461_Tensin_E_D_report'), - BitbucketRepo('staging/461_Tensin_E_D_slides'), - BitbucketRepo('staging/cgit-repos'), - BitbucketRepo('staging/deposit-calculator'), - BitbucketRepo('staging/raspi-temp-client'), - BitbucketRepo('staging/raspi-temp-server'), - BitbucketRepo('staging/x64-decoder'), - - Repo('fr24/key_mgmt', 'ssh://egor@tensin-raspi2.home/~/tmp/key_mgmt.git'), - Repo('fr24/openfortivpn', 'ssh://egor@tensin-raspi2.home/~/tmp/openfortivpn.git'), - Repo('staging/upload-shadow', 'ssh://egor@tensin-raspi2.home/~/tmp/upload-shadow.git'), -) diff --git a/pull/repo.py b/pull/repo.py new file mode 100644 index 0000000..43b55e4 --- /dev/null +++ b/pull/repo.py @@ -0,0 +1,72 @@ +import os.path + + +DEFAULT_OWNER = 'Egor Tensin' +DEFAULT_GITHUB_USER = 'egor-tensin' +DEFAULT_BITBUCKET_USER = 'egor-tensin' + + +class Repo: + @staticmethod + def extract_repo_name(repo_id): + return os.path.basename(repo_id) + + def __init__(self, repo_id, clone_url, owner=None, desc=None, + homepage=None): + self.repo_id = repo_id + self.repo_name = self.extract_repo_name(repo_id) + self.clone_url = clone_url + if owner is None: + owner = DEFAULT_OWNER + self.owner = owner + if desc is None: + if homepage is not None: + desc = homepage + elif clone_url is not None: + desc = clone_url + else: + desc = self.repo_name + self.desc = desc + self.homepage = homepage + + +class GithubRepo(Repo): + def __init__(self, repo_id, clone_url=None, owner=None, desc=None, + homepage=None, github_user=DEFAULT_GITHUB_USER): + if clone_url is None: + clone_url = self.build_clone_url(github_user, repo_id) + if homepage is None: + homepage = self.build_homepage_url(github_user, repo_id) + super().__init__(repo_id, clone_url, owner=owner, desc=desc, + homepage=homepage) + + @staticmethod + def build_clone_url(user, repo_id): + name = Repo.extract_repo_name(repo_id) + return f'ssh://git@github.com/{user}/{name}.git' + + @staticmethod + def build_homepage_url(user, repo_id): + name = Repo.extract_repo_name(repo_id) + return f'https://github.com/{user}/{name}' + + +class BitbucketRepo(Repo): + def __init__(self, repo_id, clone_url=None, owner=None, desc=None, + homepage=None, bitbucket_user=DEFAULT_BITBUCKET_USER): + if clone_url is None: + clone_url = self.build_clone_url(bitbucket_user, repo_id) + if homepage is None: + homepage = self.build_homepage_url(bitbucket_user, repo_id) + super().__init__(repo_id, clone_url, owner=owner, desc=desc, + homepage=homepage) + + @staticmethod + def build_clone_url(user, repo_id): + name = Repo.extract_repo_name(repo_id) + return f'ssh://git@bitbucket.org/{user}/{name}.git' + + @staticmethod + def build_homepage_url(user, repo_id): + name = Repo.extract_repo_name(repo_id) + return f'https://bitbucket.org/{user}/{name.lower()}' -- cgit v1.2.3