diff --git a/.github/workflows/moban-update.yml b/.github/workflows/moban-update.yml new file mode 100644 index 0000000..a58316f --- /dev/null +++ b/.github/workflows/moban-update.yml @@ -0,0 +1,29 @@ +on: [push] + +jobs: + run_moban: + runs-on: ubuntu-latest + name: synchronize templates via moban + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.7' + - name: check changes + run: | + pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible + make upstreaming + git status + git diff --exit-code + - name: Auto-commit + if: failure() + uses: docker://cdssnc/auto-commit-github-action + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: >- + This is an auto-commit, updating project meta data, + such as changelog.rst, contributors.rst diff --git a/.travis.yml b/.travis.yml index 89ce480..24395fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ stages: env: - MINREQ=0 stage: moban - install: pip install moban>=0.0.4 gitfs2 pypifs + install: pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible script: make upstreaming git-diff-check jobs: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a448422..2416a32 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Change log ================================================================================ +0.1.0 - 13.09.20220 +-------------------------------------------------------------------------------- + +**added** + +#. new project starter kits is relocated from yehua here + 0.0.12 - 26.08.20220 -------------------------------------------------------------------------------- diff --git a/changelog.yml b/changelog.yml index e350917..8872765 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,12 @@ name: pypi-mobans organisation: moremoban releases: + - changes: + - action: added + details: + - "new project starter kits is relocated from yehua here" + date: 13.09.20220 + version: 0.1.0 - changes: - action: added details: diff --git a/new-project/static/CHANGELOG.rst b/new-project/static/CHANGELOG.rst new file mode 100644 index 0000000..7398c8c --- /dev/null +++ b/new-project/static/CHANGELOG.rst @@ -0,0 +1,2 @@ +Change log +=========== diff --git a/new-project/static/CUSTOM_README.rst b/new-project/static/CUSTOM_README.rst new file mode 100644 index 0000000..ae8b966 --- /dev/null +++ b/new-project/static/CUSTOM_README.rst @@ -0,0 +1,6 @@ +{% extends 'README.rst.jj2' %} + +{%block documentation_link%} +.. image:: https://dev.azure.com/{{organisation}}/{{name}}/_apis/build/status/{{organisation}}.{{name}}?branchName=master + :target: https://dev.azure.com/{{organisation}}/{{name}}/_build/latest?definitionId=2&branchName=master +{%endblock%} diff --git a/new-project/static/MANIFEST.in b/new-project/static/MANIFEST.in new file mode 100644 index 0000000..5f13ef0 --- /dev/null +++ b/new-project/static/MANIFEST.in @@ -0,0 +1,2 @@ +include README.rst +include CHANGELOG.rst diff --git a/new-project/static/custom_setup.py.jj2 b/new-project/static/custom_setup.py.jj2 new file mode 100644 index 0000000..2f700ec --- /dev/null +++ b/new-project/static/custom_setup.py.jj2 @@ -0,0 +1 @@ +{% extends "setup.py.jj2" %} diff --git a/new-project/static/setup.cfg b/new-project/static/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/new-project/static/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/new-project/static/tests/requirements.txt.jj2 b/new-project/static/tests/requirements.txt.jj2 new file mode 100644 index 0000000..6b56e5a --- /dev/null +++ b/new-project/static/tests/requirements.txt.jj2 @@ -0,0 +1,7 @@ +{% extends "tests/requirements.txt.jj2" %} + +{%block extras %} +moban +black;python_version>="3.6" +isort;python_version>="3.6" +{%endblock%} diff --git a/new-project/templates/Makefile b/new-project/templates/Makefile new file mode 100644 index 0000000..51e0bd2 --- /dev/null +++ b/new-project/templates/Makefile @@ -0,0 +1,21 @@ +all: test + +test: lint + bash test.sh + +install_test: + pip install -r tests/requirements.txt + +git-diff-check: + git diff --exit-code + +lint: + bash lint.sh + +format: + isort -y $(find {{project_name | replace('-', '_')}} -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo) + black -l 79 {{project_name | replace('-', '_')}} + black -l 79 tests + +git-diff-check: + git diff --exit-code diff --git a/new-project/templates/__init__.py.jj2 b/new-project/templates/__init__.py.jj2 new file mode 100644 index 0000000..05d6564 --- /dev/null +++ b/new-project/templates/__init__.py.jj2 @@ -0,0 +1,3 @@ +# flake8: noqa +from {{project_name | replace('-', '_')}}._version import __version__ +from {{project_name | replace('-', '_')}}._version import __author__ diff --git a/new-project/templates/changelog.yml.jj2 b/new-project/templates/changelog.yml.jj2 new file mode 100644 index 0000000..550e150 --- /dev/null +++ b/new-project/templates/changelog.yml.jj2 @@ -0,0 +1,9 @@ +name: {{project_name}} +organisation: {{organisation}} +releases: +- changes: + - action: first release + details: + - what a feat! + version: 0.0.1 + date: {{today}} diff --git a/new-project/templates/project-moban.yml.jj2 b/new-project/templates/project-moban.yml.jj2 new file mode 100644 index 0000000..489c9cf --- /dev/null +++ b/new-project/templates/project-moban.yml.jj2 @@ -0,0 +1,33 @@ +configuration: + template_dir: + - "pypi://pypi-mobans-pkg/resources/templates" + - "pypi://pypi-mobans-pkg/resources/statics" + - ".moban.d" + configuration: {{ project_name }}.yml +targets: + - README.rst: CUSTOM_README.rst.jj2 + - setup.py: custom_setup.py.jj2 + - requirements.txt: requirements.txt.jj2 + - "tests/requirements.txt": "tests/custom_requirements.txt.jj2" + - "docs/source/conf.py": "docs/conf.py_t" + - test.sh: test.script.jj2 + - test.bat: test.script.jj2 + - "{{ project_name | replace('-', '_') }}/_version.py": "_version.py.jj2" + - .gitignore: gitignore.jj2 + - .travis.yml: travis.yml.jj2 + - Pipfile: Pipfile.jj2 + - output: CHANGELOG.rst + configuration: changelog.yml + template: CHANGELOG.rst.jj2 + - lint.sh: lint.script.jj2 + - LICENSE: "{{ license|lower }}_license.jj2" + - MANIFEST.in: MANIFEST.in.jj2 + - ".github/workflows/pythonpublish.yml": "pythonpublish.yml" + - ".github/workflows/moban-update.yml": "moban-update.yml" + - "azure-pipelines.yml": "azure/azure-pipelines.yml" + - ".azure-pipelines-steps-macos.yml": "azure/pipelines-steps-macos.yml" + - ".azure-pipelines-steps.yml": "azure/pipelines-steps.yml" + - Makefile: Makefile.jj2 + - format.sh: format.sh.jj2 + - .isort.cfg: isort.cfg.jj2 + - CONTRIBUTORS.rst: CONTRIBUTORS.rst.jj2 diff --git a/new-project/templates/project.yml.jj2 b/new-project/templates/project.yml.jj2 new file mode 100644 index 0000000..f190eb7 --- /dev/null +++ b/new-project/templates/project.yml.jj2 @@ -0,0 +1,24 @@ +name: "{{project_name}}" +organisation: "{{organisation}}" +author: "{{author}}" +contact: "{{contact}}" +company: "{{company}}" +version: "0.0.1" +current_version: "0.0.1" +release: "0.0.0" +copyright_year: {{now.year}} +{% if project_type == 'command line interface'%} +command_line_interface: "{{cli}}" +entry_point: "{{project_name | replace('-', '_')}}.main:main" +{% endif %} +{% if project_type == 'C extension'%} +external_module_library: {{project_name}} +sources: +{% for source in sources: %} + - '{{source}}' +{% endfor %} +{% endif %} +license: {{license}} +dependencies: [] +description: "{{description}}" +lint_command: make install_test lint format git-diff-check diff --git a/statics/moban-update.yml b/statics/moban-update.yml index d745b13..706fd82 100644 --- a/statics/moban-update.yml +++ b/statics/moban-update.yml @@ -14,7 +14,7 @@ jobs: python-version: '3.7' - name: check changes run: | - pip install moban gitfs2 pypifs + pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible moban git status git diff --exit-code diff --git a/templates/travis.yml.jj2 b/templates/travis.yml.jj2 index eccd2eb..aeaab9b 100644 --- a/templates/travis.yml.jj2 +++ b/templates/travis.yml.jj2 @@ -62,7 +62,7 @@ stages: env: - MINREQ=0 stage: moban - install: pip install moban>=0.0.4 gitfs2 pypifs + install: pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible {% if moban_command.startswith('moban') and 'exit-code' not in moban_command %} script: - {{ moban_command }} diff --git a/tests/requirements.txt b/tests/requirements.txt index b63a214..e54c8fc 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,6 +1,9 @@ +gease codecov -moban>=0.6.4 +moban>=0.8.2 pytest~=3.6.1 flake8 -moban_jinja2_github yamllint +moban-jinja2-github +moban-ansible +gitfs2 diff --git a/tests/test_utils.py b/tests/test_utils.py index f835248..628066a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,5 +1,8 @@ +# flake8: noqa import os +import moban_ansible.tests.files +import moban_ansible.engines.line_in_file from moban.plugins.jinja2.engine import Engine from moban.externals import file_system diff --git a/yehua.yml b/yehua.yml new file mode 100644 index 0000000..8bb3a74 --- /dev/null +++ b/yehua.yml @@ -0,0 +1,75 @@ +introduction: |+ + [info]Yehua /'jɛhwa/[/info] will walk you through. + Press ^C to quit at any time. + +configuration: + template_path: ./new-project/templates + static_path: ./new-project/static +questions: + - project_name: "project name [yehua-boilerplate]: " + - description: "description [Moremoban organisation's best template]: " + - license: + - question: "license: " + "1. mit": "N/A" + "2. newbsd": "N/A" + - author: "author: " + - contact: "contact email: " + - organisation: "github profile/organisation: " + - company: "copyright owner [{{author}}]: " + - project_type: + - question: "project type: " + "1. library": "N/A" + "2. command line interface": + - cli: "cli executable name: " +layout: + - "{{project_name|lower|replace('-', '_')}}" + - tests + - docs: + - source + - .moban.d: + - tests + - docs: + - source +templates: + - "{{project_name}}.yml": project.yml.jj2 + - "{{project_name | replace('-', '_')}}/__init__.py": "__init__.py.jj2" + - .moban.yml: project-moban.yml.jj2 + - changelog.yml: changelog.yml.jj2 + - Makefile: Makefile +static: + - ".moban.d/CUSTOM_README.rst.jj2": "CUSTOM_README.rst" + - ".moban.d/custom_setup.py.jj2": custom_setup.py.jj2 + - ".moban.d/tests/custom_requirements.txt.jj2": "tests/requirements.txt.jj2" + - CHANGELOG.rst: CHANGELOG.rst + - setup.cfg: setup.cfg +post-moban: + git-repo-files: + - "CHANGELOG.rst" + - "MANIFEST.in" + - "Makefile" + - "README.rst" + - "{{project_name}}.yml" + - "{{project_name | replace('-', '_')}}" + - "docs" + - "requirements.txt" + - "setup.cfg" + - "setup.py" + - "test.sh" + - "tests" + - ".gitignore" + - ".github" + - ".moban.d" + - ".travis.yml" + - ".moban.yml" + - "Pipfile" + - "changelog.yml" + - "lint.sh" + - "test.bat" + - "azure-pipelines.yml" + - ".azure-pipelines-steps-macos.yml" + - ".azure-pipelines-steps.yml" + - "LICENSE" + - format.sh + - lint.sh + - .isort.cfg + - CONTRIBUTORS.rst