diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c4b3b13 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +tab_width = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yaml,yml}] +indent_size = 2 +[Makefile] +indent_style = tab diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..438ff08 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +format: + black . + isort . + +changelog: + antsibull-changelog generate + +docs: format + ./update_doc + +release: changelog docs + ansible-galaxy collection build diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..24fdd01 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,32 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sanitize_changelog: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Stop50.Module +trivial_section_name: trivial +use_fqcn: true diff --git a/galaxy.yml b/galaxy.yml new file mode 100644 index 0000000..d80f5a0 --- /dev/null +++ b/galaxy.yml @@ -0,0 +1,17 @@ +--- +namespace: stop50 +name: ansible-template +version: 0.1.0 +readme: README.md +authors: + - Sebastian Tobie + +description: '' +license_file: 'LICENSE' +tags: [] +dependencies: {} + +repository: http://gitea.sebastian-tobie.de/sebastian/ansible-template.git +documentation: +issues: http://gitea.sebastian-tobie.de/sebastian/ansible-template/issues +build_ignore: [] diff --git a/meta/runtime.yml b/meta/runtime.yml new file mode 100644 index 0000000..2ee3c9f --- /dev/null +++ b/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: '>=2.9.10' diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 0000000..5cbe34c --- /dev/null +++ b/plugins/README.md @@ -0,0 +1 @@ +# ansible-template diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b65dbad --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[tool.black] +line-length = 140 + +[tool.isort] +atomic = true +profile = "black" +line_length = 140 \ No newline at end of file diff --git a/update_doc b/update_doc new file mode 100755 index 0000000..3e36c26 --- /dev/null +++ b/update_doc @@ -0,0 +1,41 @@ +#!/usr/bin/python +import importlib +import pathlib +import re +import sys + +sys.path.append(".") +mindocstring = "DOCUMENTATION = ''''''" +moduledir = pathlib.Path("plugins/modules") +regex = re.compile("DOCUMENTATION *= *r?(?P\"{3}|'{3})(---)?.*?(?P=quote)", re.MULTILINE | re.DOTALL) + +if __name__ == "__main__": + for modfile in moduledir.iterdir(): + if modfile.name in ( "__init__.py", "__pycache__", "unit.py.example"): + continue + mod = importlib.import_module(".".join((modfile.parts[:-1])+(modfile.stem,))) + if hasattr(mod, "Module"): + module = mod.Module + elif hasattr(mod, "__module_name__"): + module = getattr(mod, mod.__module_name__) + else: + print("Error loading Module of File: {}. No Module or __module_name__ defined".format(modfile)) + continue + try: + moddoc = module.doc() + except AttributeError: + print("Broken module. skipping {}".format(modfile)) + continue + except Exception as e: + print("Error in documentation of module {}: {}".format(modfile, e)) + continue + moddata = modfile.read_text() + match = regex.search(moddata) + if not match: + print("no Documentation set for module {}. Please add at least \"{}\" to the file".format(modfile.stem, mindocstring)) + continue + newmod = "{pre}DOCUMENTATION = {quote}{doc}{quote}{post}".format(pre=moddata[:match.start()], quote=match.group("quote"), doc=moddoc, post=moddata[match.end():]) + modfile.write_text(newmod) + print("updated the documentation of module {}".format(module.name)) + +# code: python