Improved publisher
This commit is contained in:
parent
b6cbafbd0d
commit
6f82bd8b35
@ -74,7 +74,7 @@ class PublishSettings(ConfigurationModelBase):
|
||||
try:
|
||||
self._source_path = settings[PublishSettingsName.source_path.value]
|
||||
self._dist_path = settings[PublishSettingsName.dist_path.value]
|
||||
self._templates = settings[PublishSettingsName.templates.value]
|
||||
self._templates = Template().from_dict(settings[PublishSettingsName.templates.value])
|
||||
self._included_files = settings[PublishSettingsName.included_files.value]
|
||||
self._excluded_files = settings[PublishSettingsName.excluded_files.value]
|
||||
self._template_ending = settings[PublishSettingsName.template_ending.value]
|
||||
|
@ -5,6 +5,7 @@
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
|
||||
"DatabaseSettings": {
|
||||
"ConnectionString": "mysql+mysqlconnector://sh_cpl:$credentials@localhost/sh_cpl",
|
||||
"Credentials": "MHZhc0Y2bjhKc1VUMWV0Qw==",
|
||||
|
57
src/tests_dev/appsettings.edrafts-pc.json
Normal file
57
src/tests_dev/appsettings.edrafts-pc.json
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"PublisherSettings": {
|
||||
"SourcePath": "../",
|
||||
"DistPath": "../../dist",
|
||||
"Templates": [
|
||||
{
|
||||
"TemplatePath": "../../publish_templates/all_template.txt",
|
||||
"Name": "all",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"CopyrightDate": "2020",
|
||||
"CopyrightName": "sh-edraft.de",
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": ", see LICENSE for more details.",
|
||||
"Title": "",
|
||||
"Author": "Sven Heidemann",
|
||||
"Version": {
|
||||
"major": 2020,
|
||||
"minor": 12,
|
||||
"micro": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"TemplatePath": "../../publish_templates/all_template.txt",
|
||||
"Name": "sh_edraft",
|
||||
"Description": "common python library",
|
||||
"LongDescription": "Library to share common classes and models used at sh-edraft.de",
|
||||
"CopyrightDate": "2020",
|
||||
"CopyrightName": "sh-edraft.de",
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": ", see LICENSE for more details.",
|
||||
"Title": "",
|
||||
"Author": "Sven Heidemann",
|
||||
"Version": {
|
||||
"major": 2020,
|
||||
"minor": 12,
|
||||
"micro": 9
|
||||
}
|
||||
}
|
||||
],
|
||||
"IncludedFiles": [],
|
||||
"ExcludedFiles": [],
|
||||
"TemplateEnding": "_template.txt"
|
||||
}
|
||||
}
|
62
src/tests_dev/publisher.py
Normal file
62
src/tests_dev/publisher.py
Normal file
@ -0,0 +1,62 @@
|
||||
from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.base import ConfigurationBase
|
||||
from sh_edraft.hosting import ApplicationHost
|
||||
from sh_edraft.hosting.base import ApplicationBase
|
||||
from sh_edraft.logging import Logger
|
||||
from sh_edraft.logging.base import LoggerBase
|
||||
from sh_edraft.publishing import Publisher
|
||||
from sh_edraft.publishing.base import PublisherBase
|
||||
from sh_edraft.service.providing.base import ServiceProviderBase
|
||||
|
||||
|
||||
class Program(ApplicationBase):
|
||||
|
||||
def __init__(self):
|
||||
ApplicationBase.__init__(self)
|
||||
|
||||
self._app_host: Optional[ApplicationHost] = None
|
||||
self._services: Optional[ServiceProviderBase] = None
|
||||
self._configuration: Optional[ConfigurationBase] = None
|
||||
self._logger: Optional[LoggerBase] = None
|
||||
self._publisher: Optional[PublisherBase] = None
|
||||
|
||||
def create_application_host(self):
|
||||
self._app_host = ApplicationHost()
|
||||
self._configuration = self._app_host.configuration
|
||||
self._services = self._app_host.services
|
||||
|
||||
def create_configuration(self):
|
||||
self._configuration.add_environment_variables('PYTHON_')
|
||||
self._configuration.add_environment_variables('CPL_')
|
||||
self._configuration.add_argument_variables()
|
||||
self._configuration.add_json_file(f'appsettings.json')
|
||||
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json')
|
||||
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True)
|
||||
|
||||
def create_services(self):
|
||||
# Add and create logger
|
||||
self._services.add_singleton(LoggerBase, Logger)
|
||||
self._logger = self._services.get_service(LoggerBase)
|
||||
|
||||
# Add and create publisher
|
||||
self._services.add_singleton(PublisherBase, Publisher)
|
||||
self._publisher: Publisher = self._services.get_service(PublisherBase)
|
||||
|
||||
def main(self):
|
||||
self._logger.header(f'{self._configuration.environment.application_name}:')
|
||||
self._logger.debug(__name__, f'Host: {self._configuration.environment.host_name}')
|
||||
self._logger.debug(__name__, f'Environment: {self._configuration.environment.environment_name}')
|
||||
self._logger.debug(__name__, f'Customer: {self._configuration.environment.customer}')
|
||||
#self._publisher.exclude()
|
||||
#self._publisher.include()
|
||||
# self._publisher.create()
|
||||
print(self._publisher)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
program = Program()
|
||||
program.create_application_host()
|
||||
program.create_configuration()
|
||||
program.create_services()
|
||||
program.main()
|
Loading…
Reference in New Issue
Block a user