Removed build form gitignore, added build command
This commit is contained in:
parent
19f0ee719c
commit
c30f0e09ad
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,7 +9,6 @@ __pycache__/
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
|
47
src/sh_edraft/cli/cpl_cli/commands/build/app.py
Normal file
47
src/sh_edraft/cli/cpl_cli/commands/build/app.py
Normal file
@ -0,0 +1,47 @@
|
||||
from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
|
||||
from sh_edraft.hosting.application_host import ApplicationHost
|
||||
from sh_edraft.hosting.base.application_base import ApplicationBase
|
||||
from sh_edraft.logging.logger import Logger
|
||||
from sh_edraft.logging.base.logger_base import LoggerBase
|
||||
from sh_edraft.publishing.publisher import Publisher
|
||||
from sh_edraft.publishing.base.publisher_base import PublisherBase
|
||||
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
|
||||
|
||||
|
||||
class BuildApp(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_json_file(f'build.json')
|
||||
|
||||
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.create()
|
||||
self._publisher.build()
|
23
src/sh_edraft/cli/cpl_cli/commands/build/build.py
Normal file
23
src/sh_edraft/cli/cpl_cli/commands/build/build.py
Normal file
@ -0,0 +1,23 @@
|
||||
from sh_edraft.cli.command.base.command_base import CommandBase
|
||||
from sh_edraft.cli.cpl_cli.commands.build.app import BuildApp
|
||||
from sh_edraft.console.console import Console
|
||||
|
||||
|
||||
class Build(CommandBase):
|
||||
|
||||
def __init__(self):
|
||||
CommandBase.__init__(self)
|
||||
self._app = BuildApp()
|
||||
|
||||
self._aliases.append('-b')
|
||||
self._aliases.append('-B')
|
||||
|
||||
def run(self, args: list[str]):
|
||||
if len(args) > 0:
|
||||
Console.error(f'Invalid arguments {args}')
|
||||
Console.error('Run \'cpl help\'')
|
||||
|
||||
self._app.create_application_host()
|
||||
self._app.create_configuration()
|
||||
self._app.create_services()
|
||||
self._app.main()
|
Loading…
Reference in New Issue
Block a user