Skip to content

Commit

Permalink
Clean up the CHANGELOG after creation
Browse files Browse the repository at this point in the history
Update README.md, .gitignore, CHANGELOG
Bump version
  • Loading branch information
dormant-user committed Aug 31, 2021
1 parent 34b1fc8 commit a6aaf7f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
__pycache__
venv
source_change_log.txt
_build
_build
local_build.py
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@
0.1.1 (08/30/2021 - 23:24:27)
-----------------------------
- auto upload to pypi when tagged a release version

0.1.2 (08/30/2021 - 23:59:10)
-----------------------------
- Create a pypi package
- Move generator.py within a source directory
- Add __init__.py, CHANGELOT, LICENSE, MANIFEST.in, setup.cfg, setup.py, version.py

0.1.3 (08/31/2021 - 00:02:16)
-----------------------------
- revert change on python-publish.yml

0.1.4 (08/31/2021 - 00:03:04)
-----------------------------
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
[![Pypi-version](https://img.shields.io/pypi/v/changelog-generator)](https://pypi.org/project/changelog-generator)
[![Pypi-py-version](https://img.shields.io/pypi/pyversions/changelog-generator)](https://pypi.org/project/changelog-generator)

![docs](https://github.com/thevickypedia/changelog-generator/actions/workflows/docs.yml/badge.svg)
![pypi](https://github.com/thevickypedia/changelog-generator/actions/workflows/python-publish.yml/badge.svg)

[![Pypi-format](https://img.shields.io/pypi/format/changelog-generator)](https://pypi.org/project/changelog-generator/#files)
[![Pypi-status](https://img.shields.io/pypi/status/changelog-generator)](https://pypi.org/project/changelog-generator)

![Maintained](https://img.shields.io/maintenance/yes/2021)
[![GitHub Repo created](https://img.shields.io/date/1630367571)](https://api.github.com/repos/thevickypedia/changelog-generator)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/thevickypedia/changelog-generator)](https://api.github.com/repos/thevickypedia/changelog-generator)
[![GitHub last commit](https://img.shields.io/github/last-commit/thevickypedia/changelog-generator)](https://api.github.com/repos/thevickypedia/changelog-generator)

# CHANGELOG generator
Generate CHANGELOG from git commit history

### Pypi Module
[https://pypi.org/project/changelog-generator/](https://pypi.org/project/changelog-generator/)

### Usage
`pip install changelog-generator`

### Pre-Commit
Install `pre-commit` to run `flake8` and `isort` for linting and `sphinx` for documentation generator.

`pip3 install pre-commit sphinx recommonmark`

`pre-commit run --all-files`

### Runbook
https://thevickypedia.github.io/changelog-generator/

## License & copyright

© Vignesh Sivanandha Rao, Changelog Generator

Licensed under the [MIT License](https://github.com/thevickypedia/changelog-generator/blob/master/LICENSE)
23 changes: 19 additions & 4 deletions changemaker/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,23 @@ def __init__(self):
remove(self.change)

def __del__(self):
"""Removes the source file as it is temporary and prints the run time."""
"""Removes the source file as it is temporary and prints the run time.
Cleans up the CHANGELOG after creation, which is to remove the commits that say Update `CHANGELOG`.
"""
remove(self.source)
with open(self.change) as file:
req_list = file.read().splitlines()
for index, element in enumerate(req_list):
if element == '- Update CHANGELOG':
req_list.pop(index)
req_list.pop(index - 1)
req_list.pop(index - 2)
req_list.pop(index - 3)
req_list = req_list[0:-1]
with open(self.change, 'w') as file:
for element in req_list:
file.write(element + '\n')
print(f'Run Time: {round(float(perf_counter()), 2)}s')

def get_commits(self) -> int:
Expand All @@ -53,9 +68,9 @@ def versions(self) -> list:
"""Generates a list of versions based on the number of commits in master branch.
Examples:
7th commit in the branch becomes version 0.0.7
37th commit becomes 0.3.7
451st commit becomes 4.5.1
- 7th commit in the branch becomes version 0.0.7
- 37th commit becomes 0.3.7
- 451st commit becomes 4.5.1
Returns:
list:
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version_info = (0, 0, 1)
version_info = (0, 1, 5)

0 comments on commit a6aaf7f

Please sign in to comment.