diff --git a/.gitignore b/.gitignore index 2f666e2..8e62a02 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,109 @@ *.orig *.DS_Store dist/ +*.swp +*.pyc +*.zip +env +# Byte-compiled / optimized / DLL files +tests/ +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/semver/__init__.py b/semver/__init__.py index 91f209b..bb744b0 100644 --- a/semver/__init__.py +++ b/semver/__init__.py @@ -18,20 +18,17 @@ class SemVer(object): self.main_branch = None self.version_type = None - self.main_branches = ['develop', 'env-test', 'env-stage', 'env-prod'] - self.major_branches = [] - self.minor_branches = ['feature', 'RightBrain-Networks/feature'] - self.patch_branches = ['hotfix', 'bugfix'] + self.main_branches = self._setting_to_array('main_branches') + self.major_branches = self._setting_to_array('major_branches') + self.minor_branches = self._setting_to_array('minor_branches') + self.patch_branches = self._setting_to_array('patch_branches') - #def _setting_to_array(self, setting): - # config = ConfigParser() - # config.read('./.bumpversion.cfg') - # value = config.get('semver', setting) - # print(str(value)) - - #return value.split(',') + def _setting_to_array(self, setting): + config = ConfigParser() + config.read('./.bumpversion.cfg') + value = config.get('semver', setting) # filter() removes empty string which is what we get if setting is blank - #return [v.strip() for v in value.split(',')] + return list(filter(bool, [v.strip() for v in value.split(',')])) # based on commit message see what branches are involved in the merge @@ -62,6 +59,7 @@ class SemVer(object): # based on branches involved see what type of versioning should be done def get_version_type(self): + print("Merged branch is "+self.merged_branch) for prefix in self.major_branches: if self.merged_branch.startswith(prefix + '/'): self.version_type = 'major' @@ -113,7 +111,6 @@ class SemVer(object): # 3) see what type of versioning we should do # 4) version the repo def run(self): - print(self.main_branches) if not self.get_branches(): raise Exception('No merge found') if self.main_branch not in self.main_branches: diff --git a/semver/__pycache__/__init__.cpython-36.pyc b/semver/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1ca636a..0000000 Binary files a/semver/__pycache__/__init__.cpython-36.pyc and /dev/null differ