Skip to content

Commit 351f5f5

Browse files
authored
merge(#47): implements pip-deploy
Changes leading to 3.0
2 parents af7bd40 + a157469 commit 351f5f5

17 files changed

+85
-69
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ htmlcov/
77
.coverage
88
.pytest_cache/
99
venv/
10+
*.egg-info/
11+
build/
12+
dist/

PREVIOUS_VERSIONS.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Installing older versions
2+
3+
## Versions
4+
5+
### 2.0.3
6+
7+
- https://github.com/andre-filho/commit-helper/releases/tag/2.0.3
8+
9+
### 1.3.1
10+
11+
- https://github.com/andre-filho/commit-helper/releases/tag/1.3.1
12+
13+
## Install guide
14+
15+
1. Make sure you have all dependencies installed:
16+
- Git
17+
- python3 and python3-pip
18+
2. Download and unzip the package of your choice
19+
3. Into the project's folder, run `pip install -r requirements.txt`. Note: `sudo` may be required
20+
4. Create a alias to executing the project: `echo "alias commit='python3 ~/.commit-helper/generator.py'" >> ~/.bashrc` might do it.
21+
5. Reload your terminal `source ~/.bashrc`
22+
6. Be happy

README.md

+10-25
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<img src="https://api.codacy.com/project/badge/Grade/595af9a088cf44e19ec2679a8c2617f6" alt="Codacy Badge">
1616
</a>
1717
<a href="https://codeclimate.com/github/andre-filho/commit-helper/test_coverage"><img src="https://api.codeclimate.com/v1/badges/0ef7545d395120222d77/test_coverage" /></a>
18-
18+
1919
</p>
2020

2121
## What does it do?
@@ -28,29 +28,10 @@ Sometimes we, the developers, go _full-loco_ while programming and make mistakes
2828

2929
## Installation
3030

31-
Just follow the commands below:
31+
In order to install one of our older versions, check our [previous releases](PREVIOUS_VERSIONS). To install the latest (pip) version, just follow the commands below:
3232

3333
```bash
34-
$ chmod +x $HOME/.commit-helper/install.sh
35-
36-
$ ./$HOME/.commit-helper/install.sh
37-
38-
# or you could type the commands below
39-
40-
# make sure you have the dependencies installed in your machine and
41-
# have git ready to use
42-
$ sudo apt install python3-pip git
43-
44-
# clone the repo into your home
45-
$ git clone https://github.com/andre-filho/commit-helper.git ~/.commit-helper
46-
47-
$ pip3 install -r ~/.commit-helper/requirements.txt
48-
49-
# create a function in your .bashrc
50-
$ echo "alias commit='python3 ~/.commit-helper/generator.py'" >> ~/.bashrc
51-
52-
# reload terminal
53-
$ source ~/.bashrc
34+
$ pip3 install commit-helper
5435
```
5536

5637
## Usage and configuration
@@ -68,11 +49,11 @@ for the sake of not losing your precious time.
6849

6950
optional arguments:
7051
-h, --help show this help message and exit
71-
--co-author CO_AUTHOR
52+
-ca, --co-author CO_AUTHOR
7253
make your friend an co-author to the commit
73-
--no-generate NO_FILE
54+
-nf, --no-file
7455
disables the creation of a commiter.yml file
75-
--convention {angular,changelog,symphony,message}
56+
-c, --convention {angular,changelog,symphony,message}
7657
Selects a convention to be used for the commit.
7758
Required if there is no commiter.yml file.
7859
```
@@ -96,6 +77,10 @@ convention: angular # tag(context): commit message
9677
9778
# or
9879
80+
convention: karma # tag(context): commit message
81+
82+
# or
83+
9984
convention: changelog # TAG: commit message
10085
10186
# or
File renamed without changes.

generator.py renamed to commit_helper/__main__.py

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
#! /usr/bin/env python3
2-
31
# dependencies imports
42
from pathlib import Path
53
from yaml import safe_load
64
from yaml import YAMLError
75
from os import system
86

97
# conventions imports
10-
from conventions.karma_angular import angular_convention
11-
from conventions.changelog import changelog_convention
12-
from conventions.symphony_cmf import symphony_convention
13-
from conventions.no_convention import just_message
8+
from .conventions.karma_angular import angular_convention
9+
from .conventions.changelog import changelog_convention
10+
from .conventions.symphony_cmf import symphony_convention
11+
from .conventions.no_convention import just_message
1412

1513
# utils imports
16-
from utils import parser_cli
17-
from utils import create_file
18-
from utils import debug
19-
from utils import get_text
20-
from utils import get_context
21-
from utils import gen_co_author
14+
from .utils.utils import parser_cli
15+
from .utils.utils import create_file
16+
from .utils.utils import debug
17+
from .utils.utils import get_text
18+
from .utils.utils import get_context
19+
from .utils.utils import gen_co_author
2220

2321

24-
def main(debug_mode=False):
22+
def main():
23+
parser = parser_cli()
24+
args = parser.parse_args()
25+
debug_mode = args.debug
26+
debug('args variable', args, debug_mode)
2527
file_path = Path('commiter.yml')
2628
debug('file_path', file_path, debug_mode)
2729
if file_path.is_file():
@@ -87,8 +89,5 @@ def main(debug_mode=False):
8789
parser.print_help()
8890

8991

90-
if __name__ == '__main__':
91-
parser = parser_cli()
92-
args = parser.parse_args()
93-
debug('args variable', args, args.debug)
94-
main(args.debug)
92+
#
93+
# main(args.debug)

commit_helper/conventions/__init__.py

Whitespace-only changes.
File renamed without changes.

commit_helper/utils/__init__.py

Whitespace-only changes.
File renamed without changes.

install.sh

100644100755
+1-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
11
#! /bin/bash
22

3-
if [command -v git]; then
4-
sudo apt-get update -qq;
5-
sudo apt install git;
6-
fi
7-
8-
if [command -v python3]; then
9-
sudo apt install python3;
10-
fi
11-
12-
if [command -v pip3]; then
13-
sudo apt install python3-pip;
14-
fi
15-
16-
git clone https://github.com/andre-filho/commit-helper.git ~/.commit-helper;
17-
18-
pip3 install --user ~/.commit-helper/requirements.txt;
19-
20-
chmod +x $HOME/.commit-helper/generator.py;
21-
22-
echo "alias commit='./$HOME/.commit-helper/generator.py' >> $HOME/.bashrc;
3+
pip3 install -e .

setup.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from setuptools import setup
2+
3+
with open("README.md", 'r') as fi:
4+
long_desc = fi.read()
5+
6+
setup( # pragma: no cover
7+
name='commit-helper',
8+
description="A python program that helps you write commits following commit conventions", # nopep8
9+
url='https://github.com/andre-filho/commit-helper',
10+
long_description=long_desc,
11+
long_description_content_type='text/markdown',
12+
author='Andre de Sousa Costa Filho',
13+
author_email='[email protected]',
14+
version='3.0.1',
15+
packages=['commit_helper'],
16+
entry_points={
17+
'console_scripts': [
18+
'commit = commit_helper.__main__:main',
19+
'commit-helper = commit_helper.__main__:main',
20+
]
21+
},
22+
install_requires=[
23+
'pyyaml',
24+
'argparse',
25+
],
26+
)

test/test_conventions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import conventions.karma_angular as angular
2-
import conventions.changelog as changelog
3-
import conventions.symphony_cmf as symphony
4-
import conventions.no_convention as no_convention
1+
import commit_helper.conventions.karma_angular as angular
2+
import commit_helper.conventions.changelog as changelog
3+
import commit_helper.conventions.symphony_cmf as symphony
4+
import commit_helper.conventions.no_convention as no_convention
55

66

77
def test_angular_convention_with_context():

test/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import utils
1+
import commit_helper.utils.utils as utils
22
# import yaml
33

44

@@ -37,7 +37,7 @@ def test_sanitize_as_empty_string():
3737
string = utils.sanitize_as_empty_string(string)
3838
if not string == 'asopdfha':
3939
raise AssertionError()
40-
40+
4141
string2 = None
4242
string2 = utils.sanitize_as_empty_string(string2)
4343
if not string2 == '':

0 commit comments

Comments
 (0)