Add "rattail-adjacent" logic for generating projects

This commit is contained in:
Lance Edgar 2023-05-05 13:30:17 -05:00
parent 62bdf82627
commit 50d1bbbe4d

View file

@ -29,7 +29,9 @@ from collections import OrderedDict
import colander import colander
from deform import widget as dfwidget from deform import widget as dfwidget
from rattail.projects import PythonProjectGenerator, PoserProjectGenerator from rattail.projects import (PythonProjectGenerator,
PoserProjectGenerator,
RattailAdjacentProjectGenerator)
from tailbone import forms from tailbone import forms
from tailbone.views import MasterView from tailbone.views import MasterView
@ -132,6 +134,10 @@ class GeneratedProjectView(MasterView):
if isinstance(generator, PythonProjectGenerator): if isinstance(generator, PythonProjectGenerator):
self.configure_form_python(form) self.configure_form_python(form)
# rattail-adjacent projects
if isinstance(generator, RattailAdjacentProjectGenerator):
self.configure_form_rattail_adjacent(form)
# poser-based projects # poser-based projects
if isinstance(generator, PoserProjectGenerator): if isinstance(generator, PoserProjectGenerator):
self.configure_form_poser(form) self.configure_form_poser(form)
@ -162,7 +168,7 @@ class GeneratedProjectView(MasterView):
f.set_helptext('pypi_name', "It's a good idea to use org name as namespace prefix here") f.set_helptext('pypi_name', "It's a good idea to use org name as namespace prefix here")
f.set_default('pypi_name', "Acme-Poser-Plus") f.set_default('pypi_name', "Acme-Poser-Plus")
def configure_form_poser(self, f): def configure_form_rattail_adjacent(self, f):
# extends_config # extends_config
f.set_label('extends_config', "Extend Config") f.set_label('extends_config', "Extend Config")
@ -175,6 +181,13 @@ class GeneratedProjectView(MasterView):
dynamic=True) dynamic=True)
f.set_default('has_cli', True) f.set_default('has_cli', True)
# extends_db
f.set_label('extends_db', "Extend DB Schema")
f.set_helptext('extends_db', "For adding custom tables/columns to the core schema")
f.set_default('extends_db', True)
def configure_form_poser(self, f):
# organization # organization
f.set_helptext('organization', 'For use with branding etc.') f.set_helptext('organization', 'For use with branding etc.')
f.set_default('organization', "Acme Foods") f.set_default('organization', "Acme Foods")
@ -184,11 +197,6 @@ class GeneratedProjectView(MasterView):
f.set_helptext('has_db', "Note that a DB is required for the Web App") f.set_helptext('has_db', "Note that a DB is required for the Web App")
f.set_default('has_db', True) f.set_default('has_db', True)
# extends_db
f.set_label('extends_db', "Extend DB Schema")
f.set_helptext('extends_db', "For adding custom tables/columns to the core schema")
f.set_default('extends_db', True)
# has_batch_schema # has_batch_schema
f.set_label('has_batch_schema', "Add Batch Schema") f.set_label('has_batch_schema', "Add Batch Schema")
f.set_helptext('has_batch_schema', 'Usually not needed - it\'s for "dynamic" (e.g. import/export) batches') f.set_helptext('has_batch_schema', 'Usually not needed - it\'s for "dynamic" (e.g. import/export) batches')
@ -266,9 +274,16 @@ class GeneratedProjectView(MasterView):
("Options", [ ("Options", [
'extends_config', 'extends_config',
'extends_db', 'extends_db',
'has_cli',
]), ]),
]) ])
# default settings
f.set_default('name', 'rattail-foo')
f.set_default('pkg_name', 'rattail_foo')
f.set_default('pypi_name', 'rattail-foo')
f.set_default('has_cli', False)
# integration_name # integration_name
f.set_helptext('integration_name', "Name of the system to be integrated") f.set_helptext('integration_name', "Name of the system to be integrated")
f.set_default('integration_name', "Foo") f.set_default('integration_name', "Foo")