Skip to content

Commit

Permalink
docs: automatically copy files from the main directory
Browse files Browse the repository at this point in the history
Fix documentation errors related to indentation. Update `changelog_generator.py` and make it suitable for post-commit hooks. Remove the "Table of Contents" from CHANGELOG.md as it was not supported by ReStructuredText and Sphinx. The "utils" directory is no more, "tree" and "types" are now used instead. Exceptions are now supported. Update SECURITY.md and fix style for README.md. Update the requirements for documentation purposes.
  • Loading branch information
hearot committed Jun 14, 2020
1 parent 63b3ad5 commit 6474fee
Show file tree
Hide file tree
Showing 54 changed files with 238 additions and 118 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,14 @@ unknown_errors.txt

# Pyrubrum documentation
docs/build

# Documentation copied files
docs/source/CHANGELOG.md
docs/source/CODE_OF_CONDUCT.md
docs/source/FEATURES.md
docs/source/LICENSE
docs/source/NOTICE
docs/source/README.md
docs/source/SECURITY.md
docs/source/_static/*
!docs/source/_static/assets
16 changes: 3 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
# Changelog

## Table of contents

* [Current version](#Current-version)
* [v0.1a1.dev5 - 2020-06-12](#v01a1dev5---2020-06-12)
* [v0.1a1.dev4 - 2020-06-09](#v01a1dev4---2020-06-09)
* [v0.1a1.dev3 - 2020-06-09](#v01a1dev3---2020-06-09)
* [v0.1a1.dev2 - 2020-06-09](#v01a1dev2---2020-06-09)
* [v0.1a1.dev1 - 2020-06-09](#v01a1dev1---2020-06-09)
* [v0.1a1.dev0 - 2020-06-09](#v01a1dev0---2020-06-09)
* [v0.1a0 - 2020-06-09](#v01a0---2020-06-09)

## Current version
## v0.1a1.dev6

### Documentation

- Add Sphinx integration and stop using`dataclasses`
- Add Sphinx integration and stop using`dataclasses` ([63b3ad54ab218ec41c72cdf65086ff1e07a64200](https://github.com/hearot/pyrubrum/commit/63b3ad54ab218ec41c72cdf65086ff1e07a64200))
- Automatically copy files from the main directory

### Fixes

Expand Down
3 changes: 2 additions & 1 deletion FEATURES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Documentation

- Add Sphinx integration and stop using`dataclasses`
- Add Sphinx integration and stop using`dataclasses` ([63b3ad54ab218ec41c72cdf65086ff1e07a64200](https://github.com/hearot/pyrubrum/commit/63b3ad54ab218ec41c72cdf65086ff1e07a64200))
- Automatically copy files from the main directory

### Fixes

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ In order to make use of the proposed examples, you need to create your own envir

### Changelog

> *See [CHANGELOG.md](./CHANGELOG.md).*
> *Find new features in [FEATURES.md](./FEATURES.md).*
> See [CHANGELOG.md](./CHANGELOG.md).
> Find new features in [FEATURES.md](./FEATURES.md).
### Commit messages

> *See [Conventional Commits](https://www.conventionalcommits.org).*
> See [Conventional Commits](https://www.conventionalcommits.org).
### Versioning

> *See [PEP 440](https://www.python.org/dev/peps/pep-0440/).*
> See [PEP 440](https://www.python.org/dev/peps/pep-0440/).
### Thanks

Expand All @@ -73,7 +73,7 @@ In order to make use of the proposed examples, you need to create your own envir

### Branding

> *See [hearot/pyrubrum-assets](https://github.com/hearot/pyrubrum-assets).*
> See [hearot/pyrubrum-assets](https://github.com/hearot/pyrubrum-assets).
### Copyright & License

Expand Down
16 changes: 11 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

## Supported Versions

| Version | Supported |
| --------- | ------------------ |
| 0.1.x | :white_check_mark: |
| < 0.1.x | :x: |
| Version | Supported |
| --------------------- | ------------------ |
| 0.1.x ||
| < 0.1.x ||
| Development releases* ||
| Alpha releases* ||
| Beta releases* ||
| Release candidates* ||

> *\*Referring to the latest release of this kind.*
## Reporting a Vulnerability

If you get to find a vulnerability, you have two choices based on the danger which is caused by it.
If you understand by yourself that the vulnerability might cause a lot of danger and may cause destructive actions, **do not open an issue and contact immediately** [Hearot](https://github.com/hearot) via gabriel@hearot.it.
Otherwise, it is recommended to open an issue using the *Bug report* template.
Otherwise, it is recommended to [open an issue](https://github.com/hearot/pyrubrum/issues/new?assignees=hearot&labels=assumed-bug&template=bug_report.md&title=%5BBug%5D) using the *Bug report* template.
28 changes: 16 additions & 12 deletions changelog_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from git import Repo
from pathlib import Path

import pyrubrum

CHANGELOG_FILE = "CHANGELOG.md"
COMMIT_URL_FORMAT = "https://github.com/%s/%s/commit/%%s"
COMMIT_URL = ""
Expand Down Expand Up @@ -67,9 +69,7 @@ def add_date(repo: Repo, version: str) -> str:

def commit_amend(repo: Repo):
try:
repo.git.add(CHANGELOG_FILE)
repo.git.add(FEATURES_FILE)
repo.git.commit("--amend", "--no-edit", "--no-verify", "-S")
repo.git.commit("--amend", "--no-edit", "--no-verify", "-S", "-a")
finally:
os.remove(TEMP_FILE)

Expand All @@ -84,6 +84,9 @@ def generate_changelog(repo: Repo):
tag = ""
next_tag = str(next(repo.iter_commits(max_count=1, max_parents=0)))

if "v" + pyrubrum.__version__ not in list(map(str, tags_list)):
CURRENT_VERSION = "v" + pyrubrum.__version__

try:
while True:
tag = next_tag
Expand Down Expand Up @@ -144,18 +147,19 @@ def generate_changelog(repo: Repo):
)

with open(changelog_file, "w", encoding="utf-8") as f:
f.write("# Changelog\n\n## Table of contents\n\n")
f.write("# Changelog\n")

for version in map(str, reversed(tags_list)):
version = version if version else CURRENT_VERSION
# f.write("\n## Table of contents\n\n")
# for version in map(str, reversed(tags_list)):
# version = version if version else CURRENT_VERSION

if version != CURRENT_VERSION:
version = add_date(repo, version)
# if version != CURRENT_VERSION:
# version = add_date(repo, version)

f.write(
" * [%s](#%s)\n"
% (version, version.replace(".", "").replace(" ", "-"))
)
# f.write(
# " * [%s](#%s)\n"
# % (version, version.replace(".", "").replace(" ", "-"))
# )

for version in map(str, reversed(tags_list)):
version = version if version else CURRENT_VERSION
Expand Down
1 change: 1 addition & 0 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
git+https://github.com/crossnox/m2r
sphinx
sphinx-rtd-theme
2 changes: 1 addition & 1 deletion docs/source/api/database/base_database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ BaseDatabase
============

.. autoclass:: pyrubrum.BaseDatabase
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/database/dict_database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ DictDatabase
============

.. autoclass:: pyrubrum.DictDatabase
:members:
:members:
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/database_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DatabaseError
=============

.. autoclass:: pyrubrum.DatabaseError
:members:
.. autoexception:: pyrubrum.DatabaseError
:members:
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/delete_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DeleteError
===========

.. autoclass:: pyrubrum.DeleteError
:members:
.. autoexception:: pyrubrum.DeleteError
:members:
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/expire_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ExpireError
===========

.. autoclass:: pyrubrum.ExpireError
:members:
.. autoexception:: pyrubrum.ExpireError
:members:
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/get_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GetError
========

.. autoclass:: pyrubrum.GetError
:members:
.. autoexception:: pyrubrum.GetError
:members:
2 changes: 1 addition & 1 deletion docs/source/api/database/errors/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Database Errors
expire_error
get_error
not_found_error
set_error
set_error
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/not_found_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NotFoundError
=============

.. autoclass:: pyrubrum.NotFoundError
:members:
.. autoexception:: pyrubrum.NotFoundError
:members:
4 changes: 2 additions & 2 deletions docs/source/api/database/errors/set_error.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SetError
========

.. autoclass:: pyrubrum.SetError
:members:
.. autoexception:: pyrubrum.SetError
:members:
2 changes: 1 addition & 1 deletion docs/source/api/database/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Database

base_database
dict_database
redis_database
redis_database
2 changes: 1 addition & 1 deletion docs/source/api/database/redis_database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ RedisDatabase
=============

.. autoclass:: pyrubrum.RedisDatabase
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/handlers/base_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ BaseHandler
===========

.. autoclass:: pyrubrum.BaseHandler
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/handlers/handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Handler
=======

.. autoclass:: pyrubrum.Handler
:members:
:members:
2 changes: 2 additions & 0 deletions docs/source/api/handlers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Handlers
handler
parameterized_base_handler
parameterized_handler
pass_handler
pass_handler_and_clean
2 changes: 1 addition & 1 deletion docs/source/api/handlers/parameterized_base_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ParameterizedBaseHandler
========================

.. autoclass:: pyrubrum.ParameterizedBaseHandler
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/handlers/parameterized_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ParameterizedHandler
====================

.. autoclass:: pyrubrum.ParameterizedHandler
:members:
:members:
4 changes: 4 additions & 0 deletions docs/source/api/handlers/pass_handler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pass_handler
============

.. autofunction:: pyrubrum.pass_handler
4 changes: 4 additions & 0 deletions docs/source/api/handlers/pass_handler_and_clean.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pass_handler_and_clean
======================

.. autofunction:: pyrubrum.pass_handler_and_clean
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Button
======

.. autoclass:: pyrubrum.Button
:members:
:members:
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Element
=======

.. autoclass:: pyrubrum.Element
:members:
:members:
9 changes: 9 additions & 0 deletions docs/source/api/keyboard/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Keyboard
========

.. toctree::
:caption: Defined objects

button
element
keyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Keyboard
========

.. autoclass:: pyrubrum.Keyboard
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/menus/base_menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ BaseMenu
========

.. autoclass:: pyrubrum.BaseMenu
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/menus/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Menus

base_menu
menu
page_menu
page_menu
2 changes: 1 addition & 1 deletion docs/source/api/menus/menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Menu
====

.. autoclass:: pyrubrum.Menu
:members:
:members:
2 changes: 1 addition & 1 deletion docs/source/api/menus/page_menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PageMenu
========

.. autoclass:: pyrubrum.PageMenu
:members:
:members:
9 changes: 9 additions & 0 deletions docs/source/api/tree/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Tree
====

.. toctree::
:caption: Defined objects

node
recursive_add
transform
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Node
====

.. autoclass:: pyrubrum.Node
:members:
:members:
4 changes: 4 additions & 0 deletions docs/source/api/tree/recursive_add.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recursive_add
=============

.. autofunction:: pyrubrum.recursive_add
4 changes: 4 additions & 0 deletions docs/source/api/tree/transform.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
transform
=========

.. autofunction:: pyrubrum.transform
4 changes: 4 additions & 0 deletions docs/source/api/types/callback.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Callback
========

.. autodata:: pyrubrum.Callback
Loading

0 comments on commit 6474fee

Please sign in to comment.