Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a starter template #526

Merged
merged 41 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c833eab
add a starter template
erral Oct 30, 2022
ff9a37d
Merge branch 'main' into erral-starter-subtemplate
erral Nov 1, 2022
a5bd5f0
rename the template
erral Nov 27, 2022
ba69c7d
Merge branch 'main' into erral-starter-subtemplate
erral Nov 27, 2022
820d0be
Merge branch 'erral-starter-subtemplate' of github.com:plone/bobtempl…
erral Nov 27, 2022
00421ba
Merge branch 'main' into erral-starter-subtemplate
MrTango Jan 20, 2023
21f40c6
Merge branch 'main' into erral-starter-subtemplate
MrTango Jan 25, 2023
3d3a764
rename profile
erral Jan 26, 2023
69ad41c
rename all template to be site_initialization
erral Jan 26, 2023
25d45a9
fix missing comma in testing.py of addon template
MrTango Jan 26, 2023
0b61d48
fix missing tox.ini in addon template
MrTango Jan 26, 2023
f2fe13d
prepare bugfix release
MrTango Jan 26, 2023
009958b
include tox.ini in MANIFEST
MrTango Jan 26, 2023
2c13048
Preparing release 6.2.1
MrTango Jan 26, 2023
d521f44
Back to development: 6.2.2
MrTango Jan 26, 2023
5e5efc1
Merge branch 'main' into erral-starter-subtemplate
erral Jan 26, 2023
95f4bcf
Merge branch 'main' into erral-starter-subtemplate
MrTango Feb 6, 2023
cbee996
fix linting
MrTango Feb 6, 2023
b63d7ca
Merge branch 'main' into erral-starter-subtemplate
erral Apr 14, 2023
6e8f1d4
convert to one-line
erral Apr 14, 2023
1d3ac09
convert to one line
erral Apr 14, 2023
c8ed16c
Merge branch 'main' into erral-starter-subtemplate
MrTango Jun 19, 2023
9990310
Merge branch 'main' into erral-starter-subtemplate
erral Oct 3, 2023
cf38694
make questions mandatory
erral Oct 3, 2023
53c78c6
update tox and CI setup for Py3.11
MrTango Oct 3, 2023
6451155
try to fix tox.ini
MrTango Oct 3, 2023
7906b89
update tox setup
MrTango Oct 3, 2023
829d9dd
test
erral Oct 7, 2023
ef882a2
test
erral Oct 7, 2023
9368cbd
test
erral Oct 7, 2023
63fd819
test
erral Oct 7, 2023
ea46774
test
erral Oct 7, 2023
392e1b6
tes
erral Oct 7, 2023
ca2dd38
fix
erral Oct 7, 2023
104a398
fix tox in CI
MrTango Oct 30, 2023
5c705de
Merge branch 'main' into erral-starter-subtemplate
MrTango Oct 30, 2023
e9e4aa3
Merge branch 'main' into erral-starter-subtemplate
MrTango Feb 22, 2024
571f0dd
recover tox arguments
erral Mar 22, 2024
2509e3f
remove python 3.11 additions
erral Mar 22, 2024
0cd7f11
remove python 3.11 additions
erral Mar 22, 2024
dfda5ee
remove docs
erral Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
pip install tox-gh-actions>=3.0.0
- name: Black-Check
run: |
tox -r -e black-check
tox -e black-check
- name: Test with tox
run: |
tox -r
erral marked this conversation as resolved.
Show resolved Hide resolved
tox
env:
PLATFORM: ${{ matrix.os }}
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ New features:
6.2 (2022-10-28)
----------------

- Add a starter subtemplate to initialize a Plone site with some sane default values
[erral]

- Improve namespace support #419
[mamico]

Expand Down
8 changes: 8 additions & 0 deletions bobtemplates/plone/bobregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ def plone_form():
reg.plonecli_alias = "form"
reg.depend_on = "plone_addon"
return reg


def plone_site_initialization():
reg = RegEntry()
reg.template = "bobtemplates.plone:site_initialization"
reg.plonecli_alias = "site_initialization"
reg.depend_on = "plone_addon"
return reg
16 changes: 16 additions & 0 deletions bobtemplates/plone/site_initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from bobtemplates.plone.base import base_prepare_renderer
from bobtemplates.plone.base import git_commit
from bobtemplates.plone.base import git_support


def prepare_renderer(configurator):
"""Prepare rendering."""
configurator = base_prepare_renderer(configurator)

configurator.target_directory = configurator.variables["package_folder"]


def post_renderer(configurator):
"""Post rendering."""
if git_support(configurator):
git_commit(configurator, "Add Plone site initialization configuration")
24 changes: 24 additions & 0 deletions bobtemplates/plone/site_initialization/.mrbob.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[questions]
subtemplate_warning.question = Please commit your changes, before using a sub-template! Continue anyway? [N/y]
subtemplate_warning.required = True
subtemplate_warning.default = n
subtemplate_warning.pre_ask_question = bobtemplates.plone.base:git_clean_state_check
subtemplate_warning.post_ask_question = mrbob.hooks:validate_choices bobtemplates.plone.base:subtemplate_warning_post_question
subtemplate_warning.choices = y|n
subtemplate_warning.choices_delimiter = |

language.question = Enter the 2 letter language code for your site
language.help = Shold be something like 'en'
language.required = True
language.default = 'en'

site_name.question = Enter the name of your site
site_name.help = Should be something like 'My new site'
site_name.required = True
site_name.default = New Plone Site


[template]
post_ask = bobtemplates.plone.base:set_global_vars
pre_render = bobtemplates.plone.site_initialization:prepare_renderer
post_render = bobtemplates.plone.site_initialization:post_renderer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.base.interfaces.controlpanel.IMailSchema" prefix="plone" purge="false">
<value key="email_from_name">{{{ site_name }}}</value>
</records>
</registry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.base.interfaces.controlpanel.ISiteSchema" prefix="plone" purge="false">
<value key="site_title">{{{ site_name }}}</value>
</records>
</registry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.i18n.interfaces.ILanguageSchema" prefix="plone" purge="false">
<value key="available_languages">
<element>{{{ language }}}</element>
</value>
<value key="default_language">{{{ language }}}</value>
</records>
</registry>
4 changes: 2 additions & 2 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# -----------------------------------------------
# Pin Versions / Version Ranges if necessary.
setuptools==57.0.0
tox==4.3.5
isort>=5
tox>=4.4.0
isort>=5.12.0
flake8==5.0.4
flake8-html==0.4.2
black==22.8.0
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 5 - Production/Stable",
"Framework :: Plone",
Expand Down Expand Up @@ -90,6 +91,7 @@
"plone_vocabulary = bobtemplates.plone.bobregistry:plone_vocabulary",
"plone_controlpanel = bobtemplates.plone.bobregistry:plone_controlpanel",
"plone_form = bobtemplates.plone.bobregistry:plone_form",
"plone_site_initialization = bobtemplates.plone.bobregistry:plone_site_initialization",
]
},
)
33 changes: 23 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
[tox]
min_version = 4.4.0


envlist =
py38-lint
py39-lint
py310-lint
py311-lint
black-check
docs
py{310,39,38}-packagetests
py{311,310,39,38}-packagetests
py{38}-skeletontests-Plone{52}-template-addon
py{310,39}-skeletontests-Plone{60}-template-addon
py{311,310,39}-skeletontests-Plone{60}-template-addon
py{38}-skeletontests-Plone{52}-template-addon_all
py{310,39}-skeletontests-Plone{60}-template-addon_all
py{310,39}-skeletontests-Plone{60}-template-addon_theme_barceoneta
py{311,310,39}-skeletontests-Plone{60}-template-addon_all
py{311,310,39}-skeletontests-Plone{60}-template-addon_theme_barceoneta
py{38,39,310}-skeletontests-Plone{60}-template-addon_mockup_pattern
coverage-report

Expand All @@ -21,6 +25,7 @@ python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
usedevelop = True
Expand All @@ -31,6 +36,7 @@ basepython:
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11

commands =
mkdir -p {toxinidir}/_build/reports/coverage {toxinidir}/_build/reports/pytest
Expand Down Expand Up @@ -63,8 +69,8 @@ allowlist_externals =
mkdir

depends =
{py310}: coverage-clean
coverage-report: py310
{py311}: coverage-clean
coverage-report: py311


[testenv:coverage-report]
Expand Down Expand Up @@ -167,25 +173,32 @@ deps = {[lint]deps}
commands = {[lint]commands}
allowlist_externals = {[lint]allowlist_externals}

[testenv:py311-lint]
basepython = python3.11
skip_install = true
deps = {[lint]deps}
commands = {[lint]commands}
allowlist_externals = {[lint]allowlist_externals}

[testenv:black-check]
basepython = python3.10
; basepython = python3.11
skip_install = True
deps =
-cconstraints.txt
black

commands =
black --check --diff -v bobtemplates setup.py skeleton-tests package_tests
black -t py311 --check --diff -v bobtemplates setup.py skeleton-tests package_tests

[testenv:black-enforce]
basepython = python3.10
basepython = python3.11
skip_install = True
deps =
-cconstraints.txt
black

commands =
black -v bobtemplates setup.py skeleton-tests package_tests
black -t py311 -v bobtemplates setup.py skeleton-tests package_tests

[testenv:docs]
basepython = python3.10
Expand Down
Loading