Fixed cpl new command

This commit is contained in:
Sven Heidemann 2022-01-15 23:28:22 +01:00
parent 24172c658c
commit 61e7b9d684
2 changed files with 21 additions and 28 deletions

View File

@ -84,8 +84,7 @@ class ConsoleBuilder:
ReadmeTemplate(), ReadmeTemplate(),
TestsInitTemplate(), TestsInitTemplate(),
AppsettingsTemplate(), AppsettingsTemplate(),
MainInitTemplate(project_name, os.path.join( MainInitTemplate(project_name, os.path.join('src/', project_name_snake))
'src/', project_name_snake))
] ]
else: else:
project_path = os.path.join( project_path = os.path.join(
@ -101,29 +100,26 @@ class ConsoleBuilder:
if not os.path.isdir(project_path): if not os.path.isdir(project_path):
os.makedirs(project_path) os.makedirs(project_path)
src_rel_path = '' py_src_rel_path = ''
src_name = project_name_snake src_name = project_name_snake
if workspace is None:
py_src_rel_path = f'src/{src_name}'
if use_application_api: if use_application_api:
templates.append(ApplicationTemplate( templates.append(ApplicationTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
if use_startup: if use_startup:
templates.append(StartupTemplate( templates.append(StartupTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async)) templates.append(MainWithApplicationHostAndStartupTemplate(src_name, py_src_rel_path, use_async))
templates.append(MainWithApplicationHostAndStartupTemplate(
src_name, src_rel_path, use_async))
else: else:
templates.append(MainWithApplicationBaseTemplate( templates.append(MainWithApplicationBaseTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
else: else:
if use_service_providing: if use_service_providing:
templates.append(MainWithDependencyInjection( templates.append(MainWithDependencyInjection(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
else: else:
templates.append(MainWithoutApplicationBaseTemplate( templates.append(MainWithoutApplicationBaseTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
src_rel_path = ''
if '/' in project_name: if '/' in project_name:
old_pj_name = project_name old_pj_name = project_name
parts = project_name.split('/') parts = project_name.split('/')

View File

@ -104,29 +104,26 @@ class LibraryBuilder:
if not os.path.isdir(project_path): if not os.path.isdir(project_path):
os.makedirs(project_path) os.makedirs(project_path)
src_rel_path = '' py_src_rel_path = ''
src_name = project_name_snake src_name = project_name_snake
if workspace is None:
py_src_rel_path = f'src/{src_name}'
if use_application_api: if use_application_api:
templates.append(ApplicationTemplate( templates.append(ApplicationTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
if use_startup: if use_startup:
templates.append(StartupTemplate( templates.append(StartupTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async)) templates.append(MainWithApplicationHostAndStartupTemplate(src_name, py_src_rel_path, use_async))
templates.append(MainWithApplicationHostAndStartupTemplate(
src_name, src_rel_path, use_async))
else: else:
templates.append(MainWithApplicationBaseTemplate( templates.append(MainWithApplicationBaseTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
else: else:
if use_service_providing: if use_service_providing:
templates.append(MainWithDependencyInjection( templates.append(MainWithDependencyInjection(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
else: else:
templates.append(MainWithoutApplicationBaseTemplate( templates.append(MainWithoutApplicationBaseTemplate(src_name, py_src_rel_path, use_async))
src_name, src_rel_path, use_async))
src_rel_path = ''
if '/' in project_name: if '/' in project_name:
old_pj_name = project_name old_pj_name = project_name
parts = project_name.split('/') parts = project_name.split('/')