2021.4.2 #12
2
cpl.json
2
cpl.json
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "2021",
|
||||
"Minor": "04",
|
||||
"Micro": "02"
|
||||
"Micro": "02.dev1"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'sh_cpl.cpl'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.application'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC
|
||||
from .startup_abc import StartupABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum
|
||||
from .console_argument import ConsoleArgument
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.console'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum
|
||||
from .spinner_thread import SpinnerThread
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings
|
||||
from .database_settings_name_enum import DatabaseSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database.connection'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection
|
||||
from .database_connection_abc import DatabaseConnectionABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database.context'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from .database_context import DatabaseContext
|
||||
from .database_context_abc import DatabaseContextABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.dependency_injection'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -29,4 +29,4 @@ from .service_provider import ServiceProvider
|
||||
from .service_provider_abc import ServiceProviderABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.environment'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum
|
||||
from .application_environment import ApplicationEnvironment
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.logging'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings
|
||||
from .logging_settings_name_enum import LoggingSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.mailing'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings
|
||||
from .email_client_settings_name_enum import EMailClientSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.time'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings
|
||||
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.utils'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .string import String
|
||||
from .pip import Pip
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'sh_cpl.cpl_cli'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -29,4 +29,4 @@ from .main import main
|
||||
from .startup import Startup
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .publish_service import PublishService
|
||||
from .version_service import VersionService
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -20,7 +20,7 @@ from cpl_cli.templates.new.console.license import LicenseTemplate
|
||||
from cpl_cli.templates.new.console.readme_py import ReadmeTemplate
|
||||
from cpl_cli.templates.new.console.src.application import ApplicationTemplate
|
||||
from cpl_cli.templates.new.console.src.main import MainWithApplicationHostAndStartupTemplate, \
|
||||
MainWithoutApplicationHostTemplate, MainWithApplicationHostTemplate
|
||||
MainWithoutApplicationBaseTemplate, MainWithApplicationBaseTemplate, MainWithDependencyInjection
|
||||
from cpl_cli.templates.new.console.src.startup import StartupTemplate
|
||||
from cpl_cli.templates.new.console.src.tests.init import TestsInitTemplate
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
@ -133,15 +133,19 @@ class NewService(CommandABC):
|
||||
|
||||
return project_path
|
||||
|
||||
def _get_project_informations(self):
|
||||
def _get_project_information(self):
|
||||
"""
|
||||
Gets project informations from user
|
||||
Gets project information's from user
|
||||
:return:
|
||||
"""
|
||||
result = Console.read('Do you want to use application host? (y/n) ')
|
||||
result = Console.read('Do you want to use application base? (y/n) ')
|
||||
if result.lower() == 'y':
|
||||
self._use_application_api = True
|
||||
|
||||
result = Console.read('Do you want to use service providing? (y/n) ')
|
||||
if result.lower() == 'y':
|
||||
self._use_service_providing = True
|
||||
|
||||
if self._use_application_api:
|
||||
result = Console.read('Do you want to use startup? (y/n) ')
|
||||
if result.lower() == 'y':
|
||||
@ -149,11 +153,6 @@ class NewService(CommandABC):
|
||||
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
|
||||
# else:
|
||||
# result = Console.read('Do you want to use service providing? (y/n) ')
|
||||
# if result.lower() == 'y':
|
||||
# self._use_service_providing = True
|
||||
|
||||
def _build_project_dir(self, project_path: str):
|
||||
"""
|
||||
Builds the project files
|
||||
@ -172,15 +171,20 @@ class NewService(CommandABC):
|
||||
ReadmeTemplate(),
|
||||
TestsInitTemplate()
|
||||
]
|
||||
|
||||
if self._use_application_api:
|
||||
templates.append(ApplicationTemplate())
|
||||
|
||||
if self._use_startup:
|
||||
templates.append(StartupTemplate())
|
||||
templates.append(MainWithApplicationHostAndStartupTemplate())
|
||||
else:
|
||||
templates.append(MainWithApplicationHostTemplate())
|
||||
templates.append(MainWithApplicationBaseTemplate())
|
||||
else:
|
||||
templates.append(MainWithoutApplicationHostTemplate())
|
||||
if self._use_service_providing:
|
||||
templates.append(MainWithDependencyInjection())
|
||||
else:
|
||||
templates.append(MainWithoutApplicationBaseTemplate())
|
||||
|
||||
for template in templates:
|
||||
Console.spinner(
|
||||
@ -225,7 +229,7 @@ class NewService(CommandABC):
|
||||
if path is None:
|
||||
return
|
||||
|
||||
self._get_project_informations()
|
||||
self._get_project_information()
|
||||
try:
|
||||
self._build_project_dir(path)
|
||||
except Exception as e:
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .version_settings import VersionSettings
|
||||
from .version_settings_name_enum import VersionSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC
|
||||
from .publisher_service import PublisherService
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.build'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.generate'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console.src'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -11,7 +11,7 @@ class ApplicationTemplate(TemplateFileABC):
|
||||
self._name = 'application.py'
|
||||
self._path = 'src/'
|
||||
self._value = textwrap.dedent("""\
|
||||
from cpl.application import ApplicationABC, ApplicationRuntimeABC
|
||||
from cpl.application import ApplicationABC
|
||||
from cpl.configuration import ConfigurationABC
|
||||
from cpl.console import Console
|
||||
from cpl.dependency_injection import ServiceProviderABC
|
||||
@ -19,8 +19,8 @@ class ApplicationTemplate(TemplateFileABC):
|
||||
|
||||
class Application(ApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, runtime: ApplicationRuntimeABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, runtime, services)
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
@ -40,7 +40,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
||||
return self._value
|
||||
|
||||
|
||||
class MainWithApplicationHostTemplate(TemplateFileABC):
|
||||
class MainWithApplicationBaseTemplate(TemplateFileABC):
|
||||
|
||||
def __init__(self):
|
||||
TemplateFileABC.__init__(self)
|
||||
@ -75,7 +75,7 @@ class MainWithApplicationHostTemplate(TemplateFileABC):
|
||||
return self._value
|
||||
|
||||
|
||||
class MainWithoutApplicationHostTemplate(TemplateFileABC):
|
||||
class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
||||
|
||||
def __init__(self):
|
||||
TemplateFileABC.__init__(self)
|
||||
@ -105,3 +105,49 @@ class MainWithoutApplicationHostTemplate(TemplateFileABC):
|
||||
@property
|
||||
def value(self) -> str:
|
||||
return self._value
|
||||
|
||||
|
||||
class MainWithDependencyInjection(TemplateFileABC):
|
||||
|
||||
def __init__(self):
|
||||
TemplateFileABC.__init__(self)
|
||||
|
||||
self._name = 'main.py'
|
||||
self._path = 'src/'
|
||||
self._value = textwrap.dedent("""\
|
||||
from cpl.configuration import Configuration, ConfigurationABC
|
||||
from cpl.console import Console
|
||||
from cpl.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||
|
||||
|
||||
def configure_configuration() -> ConfigurationABC:
|
||||
config = Configuration()
|
||||
return config
|
||||
|
||||
|
||||
def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
||||
services = ServiceCollection(config)
|
||||
return services.build_service_provider()
|
||||
|
||||
|
||||
def main():
|
||||
config = configure_configuration()
|
||||
provider = configure_services(config)
|
||||
Console.write_line('Hello World')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
""")
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def path(self) -> str:
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def value(self) -> str:
|
||||
return self._value
|
||||
|
@ -11,18 +11,18 @@ class StartupTemplate(TemplateFileABC):
|
||||
self._name = 'startup.py'
|
||||
self._path = 'src/'
|
||||
self._value = textwrap.dedent("""\
|
||||
from cpl.application import ApplicationRuntimeABC, StartupABC
|
||||
from cpl.application import StartupABC
|
||||
from cpl.configuration import ConfigurationABC
|
||||
from cpl.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, runtime: ApplicationRuntimeABC, services: ServiceProviderABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
self._configuration = config
|
||||
self._application_runtime = runtime
|
||||
self._environment = self._configuration.environment
|
||||
self._services = services
|
||||
|
||||
def configure_configuration(self) -> ConfigurationABC:
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console.src.tests'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.publish'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4.2'
|
||||
__version__ = '2021.4.2.dev1'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02')
|
||||
version_info = VersionInfo(major='2021', minor='04', micro='02.dev1')
|
||||
|
@ -1,13 +0,0 @@
|
||||
from cpl.console.console import Console
|
||||
|
||||
from model.test_model import TestModel
|
||||
|
||||
|
||||
def main():
|
||||
Console.write_line('Hello World')
|
||||
Console.write_line('Dies ist ein test')
|
||||
test = TestModel()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,22 +0,0 @@
|
||||
import time
|
||||
|
||||
from cpl.console import Console
|
||||
|
||||
|
||||
class TestModel:
|
||||
|
||||
def __init__(self):
|
||||
Console.spinner('Waiting: ', self._wait, 10)
|
||||
option = Console.select('->', 'Select option: ', [
|
||||
'Option 1',
|
||||
'Option 2',
|
||||
'Option 3',
|
||||
'Option 4',
|
||||
'Option 5',
|
||||
'Option 6'
|
||||
])
|
||||
Console.write_line('You selected', option)
|
||||
|
||||
@staticmethod
|
||||
def _wait(count: int):
|
||||
time.sleep(count)
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "cpl-test",
|
||||
"Name": "simple-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
@ -16,18 +16,20 @@
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.1.post13"
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": "/home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_common_py_lib/src/tests/custom/general/../../../../cpl-env/bin/python3.9",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "cpl-test",
|
||||
"IncludePackageData": true,
|
||||
"EntryPoint": "simple-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
16
src/tests/generated/simple-app/src/application.py
Normal file
16
src/tests/generated/simple-app/src/application.py
Normal file
@ -0,0 +1,16 @@
|
||||
from cpl.application import ApplicationABC
|
||||
from cpl.configuration import ConfigurationABC
|
||||
from cpl.console import Console
|
||||
from cpl.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line('Hello World')
|
12
src/tests/generated/simple-app/src/main.py
Normal file
12
src/tests/generated/simple-app/src/main.py
Normal file
@ -0,0 +1,12 @@
|
||||
from cpl.application import ApplicationBuilder
|
||||
|
||||
from application import Application
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
0
src/tests/generated/simple-console/README.md
Normal file
0
src/tests/generated/simple-console/README.md
Normal file
41
src/tests/generated/simple-console/cpl.json
Normal file
41
src/tests/generated/simple-console/cpl.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-console",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "simple-console",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
9
src/tests/generated/simple-console/src/main.py
Normal file
9
src/tests/generated/simple-console/src/main.py
Normal file
@ -0,0 +1,9 @@
|
||||
from cpl.console import Console
|
||||
|
||||
|
||||
def main():
|
||||
Console.write_line('Hello World')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
1
src/tests/generated/simple-console/src/tests/__init__.py
Normal file
1
src/tests/generated/simple-console/src/tests/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# imports:
|
0
src/tests/generated/startup-app/LICENSE
Normal file
0
src/tests/generated/startup-app/LICENSE
Normal file
0
src/tests/generated/startup-app/README.md
Normal file
0
src/tests/generated/startup-app/README.md
Normal file
41
src/tests/generated/startup-app/cpl.json
Normal file
41
src/tests/generated/startup-app/cpl.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "startup-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "startup-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
16
src/tests/generated/startup-app/src/application.py
Normal file
16
src/tests/generated/startup-app/src/application.py
Normal file
@ -0,0 +1,16 @@
|
||||
from cpl.application import ApplicationABC
|
||||
from cpl.configuration import ConfigurationABC
|
||||
from cpl.console import Console
|
||||
from cpl.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line('Hello World')
|
14
src/tests/generated/startup-app/src/main.py
Normal file
14
src/tests/generated/startup-app/src/main.py
Normal file
@ -0,0 +1,14 @@
|
||||
from cpl.application import ApplicationBuilder
|
||||
|
||||
from application import Application
|
||||
from startup import Startup
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_startup(Startup)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
20
src/tests/generated/startup-app/src/startup.py
Normal file
20
src/tests/generated/startup-app/src/startup.py
Normal file
@ -0,0 +1,20 @@
|
||||
from cpl.application import StartupABC
|
||||
from cpl.configuration import ConfigurationABC
|
||||
from cpl.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
self._configuration = config
|
||||
self._environment = self._configuration.environment
|
||||
self._services = services
|
||||
|
||||
def configure_configuration(self) -> ConfigurationABC:
|
||||
return self._configuration
|
||||
|
||||
def configure_services(self) -> ServiceProviderABC:
|
||||
return self._services
|
||||
|
1
src/tests/generated/startup-app/src/tests/__init__.py
Normal file
1
src/tests/generated/startup-app/src/tests/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# imports:
|
Loading…
Reference in New Issue
Block a user