From 086d91f13ac5d825beb250e39e9bb4c2946b9f1c Mon Sep 17 00:00:00 2001 From: Andre Filho Date: Sat, 12 Jan 2019 19:42:50 -0200 Subject: [PATCH 1/4] feat(file): added support to commit-helper.yml files --- README.md | 8 ++++---- VERSION.txt | 2 +- commit_helper/__main__.py | 3 ++- commit_helper/utils/file_handler.py | 11 +++++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 67f4bdc..12d205c 100644 --- a/README.md +++ b/README.md @@ -104,10 +104,10 @@ optional arguments: Pass your commit context directly -ca CO_AUTHOR, --co-author CO_AUTHOR Make your friend an co-author to the commit - -nf, --no-file Disables the creation of a commiter.yml file + -nf, --no-file Disables the creation of a commiter.yml or commit-helper.yml file -c {angular,karma,tagged,symphony,message}, --convention {angular,karma,tagged,symphony,message} Selects a convention to be used for the commit. - Required if there's no commiter.yml file. + Required if there's no commiter.yml or commit-helper.yml file. -d, --debug Toggles debug option ``` @@ -124,7 +124,7 @@ Or if you are using this for the first time in your project: $ commit --convention tagged ``` -To work even more smoothly, have in your working directory a file named **commiter.yml**. In this file you must pass the commit convention that you want to use, following the example: +To work even more smoothly, have in your working directory a file named **commiter.yml or commit-helper.yml**. In this file you must pass the commit convention that you want to use, following the example: ```yaml convention: angular # tag(context): commit message @@ -146,7 +146,7 @@ convention: symphony # [Tag] commit message convention: none # Commit message ``` -In case that you or your organization does already have a commit convention that is not listed above, you can configure it in the commiter.yml file as following: +In case that you or your organization does already have a commit convention that is not listed above, you can configure it in the commiter.yml or commit-helper.yml file as following: ```yaml convention: custom diff --git a/VERSION.txt b/VERSION.txt index 618659f..2a6849c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.4.13 +3.4.14 diff --git a/commit_helper/__main__.py b/commit_helper/__main__.py index df85daa..3246115 100755 --- a/commit_helper/__main__.py +++ b/commit_helper/__main__.py @@ -4,6 +4,7 @@ from .utils.utils import parser_cli from .utils.text_utils import debug from .utils.file_handler import handle_file_based_commit +from .utils.file_handler import get_file_path from .utils.flag_commit_handler import convention_flag_handler # convention imports from .conventions.convention_help_handler import convention_help_handler @@ -16,7 +17,7 @@ def main(): debug('args variable', args, debug_mode) - file_path = Path('commiter.yml') + file_path = get_file_path() debug('file_path', file_path, debug_mode) diff --git a/commit_helper/utils/file_handler.py b/commit_helper/utils/file_handler.py index e49f788..036ba88 100644 --- a/commit_helper/utils/file_handler.py +++ b/commit_helper/utils/file_handler.py @@ -1,4 +1,5 @@ from os import system +from pathlib import Path from yaml import safe_load from yaml import YAMLError # utils imports @@ -44,3 +45,13 @@ def handle_file_based_commit(file_path, debug_mode, args): except YAMLError as err: print(err) + + +def get_file_path(): # pragma: no cover + commiter = Path('commiter.yml') + commit_h = Path('commit-helper.yml') + + if commiter.exists(): + return commiter + else: + return commit_h From d599a73d27a2ceddd670c5f1528c23b28f891552 Mon Sep 17 00:00:00 2001 From: Andre Filho Date: Wed, 22 May 2019 14:45:34 -0300 Subject: [PATCH 2/4] ci: trying ci --- dev-requirements.txt | 31 +++++++++++++++++++++++++++++++ requirements.txt | 28 ---------------------------- 2 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 dev-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..e7e1fc0 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,31 @@ +argh~=0.26.2 +atomicwrites~=1.3.0 +attrs~=19.1.0 +certifi~=2019.3.9 +chardet~=3.0.4 +codacy-coverage~=1.3.11 +codeclimate-test-reporter~=0.2.3 +colorama~=0.4.1 +colored~=1.3.93 +coverage~=4.5.3 +docopt~=0.6.2 +idna~=2.8 +more-itertools~=7.0.0 +pathlib~=1.0.1 +pathtools~=0.1.2 +pip~=19.0.3 +pluggy>=0.9.0 +py~=1.8.0 +pycodestyle~=2.5.0 +pytest~=4.4.0 +pytest-cov~=2.6.1 +pytest-watch~=4.2.0 +pyyaml>=4.2b1 +requests~=2.21.0 +setuptools~=40.8.0 +six~=1.12.0 +urllib3~=1.24.1 +watchdog~=0.9.0 +wheel~=0.33.1 + +twine~=1.13.0 diff --git a/requirements.txt b/requirements.txt index e7e1fc0..4ad91d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,31 +1,3 @@ -argh~=0.26.2 -atomicwrites~=1.3.0 -attrs~=19.1.0 -certifi~=2019.3.9 -chardet~=3.0.4 -codacy-coverage~=1.3.11 -codeclimate-test-reporter~=0.2.3 colorama~=0.4.1 colored~=1.3.93 -coverage~=4.5.3 -docopt~=0.6.2 -idna~=2.8 -more-itertools~=7.0.0 -pathlib~=1.0.1 -pathtools~=0.1.2 -pip~=19.0.3 -pluggy>=0.9.0 -py~=1.8.0 -pycodestyle~=2.5.0 -pytest~=4.4.0 -pytest-cov~=2.6.1 -pytest-watch~=4.2.0 pyyaml>=4.2b1 -requests~=2.21.0 -setuptools~=40.8.0 -six~=1.12.0 -urllib3~=1.24.1 -watchdog~=0.9.0 -wheel~=0.33.1 - -twine~=1.13.0 From e2d86890178cd8c574edff66ab209e3c6d70930f Mon Sep 17 00:00:00 2001 From: Andre Filho Date: Wed, 22 May 2019 14:59:21 -0300 Subject: [PATCH 3/4] chore(req): updating requirements --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4ad91d7..405905c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -colorama~=0.4.1 -colored~=1.3.93 +colorama>=0.4.1 +colored>=1.3.93 pyyaml>=4.2b1 +argparse>=1.2.0 From e18cb6de65e2e2373e9807240d3446ea2a7ac202 Mon Sep 17 00:00:00 2001 From: Andre Filho Date: Wed, 22 May 2019 15:19:21 -0300 Subject: [PATCH 4/4] fix(ci): pycodestyle on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c9ef3cf..75ab038 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - '3.6' install: -- pip install -r requirements.txt +- pip install -r dev-requirements.txt script: - pytest test/ -v