diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-03-06 21:32:40 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-03-06 21:32:40 +0100 |
commit | 92661088c7a61f3f53c4aa56bc5f7257a6487075 (patch) | |
tree | d7c4be5cca73ec48bafa9086f99fcd74e8976bba /gitautodeploy/parsers/WebhookRequestParser.py | |
parent | 7b0379c66dc3c5268f60defce767e9a7893995b4 (diff) | |
parent | edaec6df3c2b3b9c32b63b97c620b9ce204a21ed (diff) | |
download | Git-Auto-Deploy-92661088c7a61f3f53c4aa56bc5f7257a6487075.zip Git-Auto-Deploy-92661088c7a61f3f53c4aa56bc5f7257a6487075.tar.gz Git-Auto-Deploy-92661088c7a61f3f53c4aa56bc5f7257a6487075.tar.bz2 |
Merge pull request #73 from olipo186/development-two
Moved files around into new project structure. Work in progress.
Diffstat (limited to 'gitautodeploy/parsers/WebhookRequestParser.py')
-rw-r--r-- | gitautodeploy/parsers/WebhookRequestParser.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gitautodeploy/parsers/WebhookRequestParser.py b/gitautodeploy/parsers/WebhookRequestParser.py new file mode 100644 index 0000000..42cbbdd --- /dev/null +++ b/gitautodeploy/parsers/WebhookRequestParser.py @@ -0,0 +1,24 @@ + +class WebhookRequestParser(object): + """Abstract parent class for git service parsers. Contains helper + methods.""" + + def __init__(self, config): + self._config = config + + def get_matching_repo_configs(self, urls): + """Iterates over the various repo URLs provided as argument (git://, + ssh:// and https:// for the repo) and compare them to any repo URL + specified in the config""" + + configs = [] + for url in urls: + for repo_config in self._config['repositories']: + if repo_config in configs: + continue + if repo_config['url'] == url: + configs.append(repo_config) + elif 'url_without_usernme' in repo_config and repo_config['url_without_usernme'] == url: + configs.append(repo_config) + + return configs
\ No newline at end of file |