Skip to content

Commit

Permalink
Make plugin cookiecutter more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed Nov 6, 2023
1 parent 5345a5b commit f84d77f
Show file tree
Hide file tree
Showing 22 changed files with 14 additions and 17 deletions.
17 changes: 8 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ package using pip. Next, use it to bootstrap your project folder::
You'll be prompted for some questions. Answer them, and you will find a
project folder created for you::

repo_name [pretalx-superplugin]: pretalx-superplugin
repo_url [GitHub repository URL]: https://github.com/myuser/pretalx-superplugin
module_name [pretalx_superplugin]: pretalx_superplugin
human_name [The pretalx super plugin]: Super Plugin
author_name [Your name]: J Random Developer
author_email [Your email]: [email protected]
short_description [Short description]: The best plugin
Select category:
[1/7] human_name (pretalx FooBar plugin): pretalx JSON plugin
[2/7] module_name (pretalx_json):
[3/7] short_description (pretalx plugin for pretalx JSON plugin): pretalx plugin for custom JSON exports
[4/7] author_name (Your name): Tobias Kunze
[5/7] author_email ([email protected]): [email protected]
[6/7] repo_url (https://github.com/r/pretalx-json): https://github.com/rixx/pretalx-json
[7/7] Select category
1 - FEATURE
2 - INTEGRATION
3 - CUSTOMIZATION
4 - EXPORTER
5 - RECORDING
6 - LANGUAGE
7 - OTHER
Choose from 1, 2, 3, 4, 5 [1]: 1
Choose from [1/2/3/4/5/6/7] (1): 1

Now, change to the newly created directory::

Expand Down
7 changes: 4 additions & 3 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"human_name": "pretalx FooBar plugin",
"module_name": "{{ cookiecutter.human_name.replace('pretalx', '').replace('the', '').strip().replace(' ', '_').replace('-', '_').replace('__', '_') }}",
"module_name": "pretalx_{{ cookiecutter.human_name.lower().replace('pretalx', '').replace('the', '').replace('plugin', '').strip().replace(' ', '_').replace('-', '_').replace('__', '_') }}",
"short_description": "pretalx plugin for {{ cookiecutter.human_name }}",
"author_name": "Your name",
"author_email": "[email protected]",
"repo_url": "https://github.com/{{ cookiecutter.author_email.split('@')[0] }}/{{ cookiecutter.module_name.replace('_', '-') }}",
"__repo_name": "{{ cookiecutter.module_name.replace('_', '-') }}",
"__model_name": "{{ cookiecutter.module_name.replace('pretalx_', '').split('_')|map('capitalize')|join }}",
"repo_url": "https://github.com/{{ cookiecutter.author_email.split('@')[0] }}/{{ cookiecutter.__repo_name }}",
"category": ["FEATURE", "INTEGRATION", "CUSTOMIZATION", "EXPORTER", "RECORDING", "LANGUAGE", "OTHER"]
"__model_name": "{{ cookiecutter.module_name.split('-')|map('capitalize')|join }}}",
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Development setup

1. Make sure that you have a working `pretalx development setup`_.

2. Clone this repository, eg to ``local/{{ cookiecutter.repo_name }}``.
2. Clone this repository, eg to ``local/{{ cookiecutter.__repo_name }}``.

3. Activate the virtual environment you use for pretalx development.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "{{cookiecutter.repo_name}}"
name = "{{cookiecutter.__repo_name}}"
dynamic = ["version"]
description = "{{cookiecutter.short_description}}"
readme = "README.rst"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% if cookiecutter.category != "LANGUAGE" %}
from django import forms
from django.utils.translation import gettext_lazy as _
from i18nfield.forms import I18nModelForm

from .models import {{ cookiecutter.__model_name }}Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
name="settings",
),
]
urlpatterns += router.urls
{% endif %}
Empty file.
Empty file.

0 comments on commit f84d77f

Please sign in to comment.