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

View File

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