summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/parsers/WebhookRequestParser.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-03-06 21:32:40 +0100
committerOliver Poignant <oliver@poignant.se>2016-03-06 21:32:40 +0100
commit92661088c7a61f3f53c4aa56bc5f7257a6487075 (patch)
treed7c4be5cca73ec48bafa9086f99fcd74e8976bba /gitautodeploy/parsers/WebhookRequestParser.py
parent7b0379c66dc3c5268f60defce767e9a7893995b4 (diff)
parentedaec6df3c2b3b9c32b63b97c620b9ce204a21ed (diff)
downloadGit-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.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