summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy/parsers/WebhookRequestParser.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-03-06 03:10:49 +0100
committerOliver Poignant <oliver@poignant.se>2016-03-06 03:10:49 +0100
commitec1f2a28c902855aa470f8523eea33f8aed6a2b5 (patch)
treef6d1c7bc0ef697e61d2bb541ceaf93fc34a94b30 /GitAutoDeploy/parsers/WebhookRequestParser.py
parentcb07ff7f12ca09dea3cfa2926a7fa04c7bea9813 (diff)
downloadGit-Auto-Deploy-ec1f2a28c902855aa470f8523eea33f8aed6a2b5.zip
Git-Auto-Deploy-ec1f2a28c902855aa470f8523eea33f8aed6a2b5.tar.gz
Git-Auto-Deploy-ec1f2a28c902855aa470f8523eea33f8aed6a2b5.tar.bz2
Module based file structure. Separated service specific implementations into their own classes.
Diffstat (limited to 'GitAutoDeploy/parsers/WebhookRequestParser.py')
-rw-r--r--GitAutoDeploy/parsers/WebhookRequestParser.py24
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