2021.10 #41
@ -2,8 +2,10 @@
|
|||||||
"WorkspaceSettings": {
|
"WorkspaceSettings": {
|
||||||
"DefaultProject": "cpl_cli",
|
"DefaultProject": "cpl_cli",
|
||||||
"Projects": {
|
"Projects": {
|
||||||
"cpl": "src/cpl/cpl.json",
|
"cpl_core": "src/cpl_core/cpl_core.json",
|
||||||
"cpl_cli": "src/cpl_cli/cpl_cli.json"
|
"cpl_cli": "src/cpl_cli/cpl_cli.json",
|
||||||
}
|
"cpl_query": "src/cpl_query/cpl_query.json"
|
||||||
|
},
|
||||||
|
"Scripts": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
4
docs/build/html/_sources/quickstart.md.txt
vendored
4
docs/build/html/_sources/quickstart.md.txt
vendored
@ -83,7 +83,7 @@ To create the sample project to the following:
|
|||||||
3. Add ```Console.select``` as follows:
|
3. Add ```Console.select``` as follows:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -156,7 +156,7 @@ To create the sample project to the following:
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def generate_password(letters: str, length: int) -> str:
|
def generate_password(letters: str, length: int) -> str:
|
||||||
|
@ -83,7 +83,7 @@ To create the sample project to the following:
|
|||||||
3. Add ```Console.select``` as follows:
|
3. Add ```Console.select``` as follows:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -156,7 +156,7 @@ To create the sample project to the following:
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def generate_password(letters: str, length: int) -> str:
|
def generate_password(letters: str, length: int) -> str:
|
||||||
|
@ -1,39 +1,54 @@
|
|||||||
upload:
|
upload:
|
||||||
prod:
|
prod:
|
||||||
cpl:
|
cpl:
|
||||||
twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload -r pip.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
cli:
|
cli:
|
||||||
twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
|
|
||||||
|
query:
|
||||||
|
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
|
||||||
exp:
|
exp:
|
||||||
cpl:
|
cpl:
|
||||||
twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
|
|
||||||
|
query:
|
||||||
|
twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
cpl:
|
cpl:
|
||||||
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl/publish/setup/*
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-core/publish/setup/*
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/*
|
||||||
|
|
||||||
|
query:
|
||||||
|
twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/*
|
||||||
|
|
||||||
install:
|
install:
|
||||||
prod:
|
prod:
|
||||||
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl
|
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl
|
||||||
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl-cli
|
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl-cli
|
||||||
|
pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl-query
|
||||||
|
|
||||||
exp:
|
exp:
|
||||||
pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl
|
pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl
|
||||||
pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl-cli
|
pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl-cli
|
||||||
|
pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl-query
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl
|
pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl
|
||||||
pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl-cli
|
pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl-cli
|
||||||
|
pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl-query
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
# activate venv
|
# activate venv
|
||||||
source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate
|
source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate
|
||||||
|
|
||||||
# CLI
|
# CPL
|
||||||
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_core
|
||||||
cpl build
|
cpl build
|
||||||
|
|
||||||
# CPL
|
# CLI
|
||||||
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_cli
|
||||||
|
cpl build
|
||||||
|
|
||||||
|
# CPL Query
|
||||||
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_query
|
||||||
cpl build
|
cpl build
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd ../docs/
|
cd ../docs/
|
||||||
sphinx-apidoc -o source/ ../src/cpl
|
sphinx-apidoc -o source/ ../src/cpl_core
|
||||||
make clean
|
make clean
|
||||||
make html;
|
make html;
|
1
scripts/hello_world.py
Normal file
1
scripts/hello_world.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
print('Hello World')
|
@ -2,10 +2,14 @@
|
|||||||
# activate venv
|
# activate venv
|
||||||
source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate
|
source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate
|
||||||
|
|
||||||
# CLI
|
# CPL
|
||||||
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_core
|
||||||
cpl publish
|
cpl publish
|
||||||
|
|
||||||
# CPL
|
# CLI
|
||||||
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_cli
|
||||||
|
cpl publish
|
||||||
|
|
||||||
|
# CPL Query
|
||||||
|
cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_query
|
||||||
cpl publish
|
cpl publish
|
16
scripts/upload.sh
Normal file
16
scripts/upload.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $1 == "-prod" ]; then
|
||||||
|
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
||||||
|
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
||||||
|
twine upload -r pip.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
||||||
|
elif [ $1 == "-prod" ]; then
|
||||||
|
twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
||||||
|
twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
||||||
|
twine upload -r pip-.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
||||||
|
|
||||||
|
else
|
||||||
|
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/*
|
||||||
|
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-core/publish/setup/*
|
||||||
|
twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-query/publish/setup/*
|
||||||
|
fi
|
@ -1,36 +0,0 @@
|
|||||||
from typing import Type, Optional
|
|
||||||
|
|
||||||
from cpl.application.application_abc import ApplicationABC
|
|
||||||
from cpl.application.application_builder_abc import ApplicationBuilderABC
|
|
||||||
from cpl.application.startup_abc import StartupABC
|
|
||||||
from cpl.configuration.configuration import Configuration
|
|
||||||
from cpl.dependency_injection.service_collection import ServiceCollection
|
|
||||||
|
|
||||||
|
|
||||||
class ApplicationBuilder(ApplicationBuilderABC):
|
|
||||||
r"""This is class is used to build a object of :class:`cpl.application.application_abc.ApplicationABC`
|
|
||||||
|
|
||||||
Parameter
|
|
||||||
---------
|
|
||||||
app: Type[:class:`cpl.application.application_abc.ApplicationABC`]
|
|
||||||
Application to build
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, app: Type[ApplicationABC]):
|
|
||||||
ApplicationBuilderABC.__init__(self)
|
|
||||||
self._app = app
|
|
||||||
self._startup: Optional[StartupABC] = None
|
|
||||||
|
|
||||||
self._configuration = Configuration()
|
|
||||||
self._environment = self._configuration.environment
|
|
||||||
self._services = ServiceCollection(self._configuration)
|
|
||||||
|
|
||||||
def use_startup(self, startup: Type[StartupABC]):
|
|
||||||
self._startup = startup(self._configuration, self._services)
|
|
||||||
|
|
||||||
def build(self) -> ApplicationABC:
|
|
||||||
if self._startup is not None:
|
|
||||||
self._startup.configure_configuration()
|
|
||||||
self._startup.configure_services()
|
|
||||||
|
|
||||||
return self._app(self._configuration, self._services.build_service_provider())
|
|
@ -1,32 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
|
||||||
|
|
||||||
|
|
||||||
class StartupABC(ABC):
|
|
||||||
r"""ABC for the startup class"""
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self, *args):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def configure_configuration(self) -> ConfigurationABC:
|
|
||||||
r"""Creates configuration of application
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
Object of :class:`cpl.configuration.configuration_abc.ConfigurationABC`
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def configure_services(self) -> ServiceProviderABC:
|
|
||||||
r"""Creates service provider
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
Object of :class:`cpl.dependency_injection.service_provider_abc.ServiceProviderABC`
|
|
||||||
"""
|
|
||||||
pass
|
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -29,4 +29,4 @@ from .main import main
|
|||||||
from .startup import Startup
|
from .startup import Startup
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ class ConfigModelTemplate(TemplateFileABC):
|
|||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
class $Name(ConfigurationModelABC):
|
class $Name(ConfigurationModelABC):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -11,10 +11,10 @@ class ApplicationTemplate(TemplateFileABC):
|
|||||||
self._name = 'application.py'
|
self._name = 'application.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.application import ApplicationABC
|
from cpl_core.application import ApplicationABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl.dependency_injection import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
class Application(ApplicationABC):
|
class Application(ApplicationABC):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
from cpl_cli._templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
from cpl.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
from {import_pkg}startup import Startup
|
from {import_pkg}startup import Startup
|
||||||
@ -57,7 +57,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
from cpl.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
|||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -132,9 +132,9 @@ class MainWithDependencyInjection(TemplateFileABC):
|
|||||||
import_pkg = f'{name}.'
|
import_pkg = f'{name}.'
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.configuration import Configuration, ConfigurationABC
|
from cpl_core.configuration import Configuration, ConfigurationABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl.dependency_injection import ServiceCollection, ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
def configure_configuration() -> ConfigurationABC:
|
def configure_configuration() -> ConfigurationABC:
|
||||||
|
@ -11,9 +11,9 @@ class StartupTemplate(TemplateFileABC):
|
|||||||
self._name = 'startup.py'
|
self._name = 'startup.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.application import StartupABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
|
|
||||||
|
|
||||||
class Startup(StartupABC):
|
class Startup(StartupABC):
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -11,10 +11,10 @@ class ApplicationTemplate(TemplateFileABC):
|
|||||||
self._name = 'application.py'
|
self._name = 'application.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.application import ApplicationABC
|
from cpl_core.application import ApplicationABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl.dependency_injection import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
class Application(ApplicationABC):
|
class Application(ApplicationABC):
|
||||||
|
@ -16,7 +16,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
|||||||
import_pkg = ''
|
import_pkg = ''
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
from cpl.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
from {import_pkg}startup import Startup
|
from {import_pkg}startup import Startup
|
||||||
@ -58,7 +58,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
|
|||||||
import_pkg = ''
|
import_pkg = ''
|
||||||
|
|
||||||
self._value = textwrap.dedent(f"""\
|
self._value = textwrap.dedent(f"""\
|
||||||
from cpl.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from {import_pkg}application import Application
|
from {import_pkg}application import Application
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
|
|||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -127,9 +127,9 @@ class MainWithDependencyInjection(TemplateFileABC):
|
|||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.configuration import Configuration, ConfigurationABC
|
from cpl_core.configuration import Configuration, ConfigurationABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl.dependency_injection import ServiceCollection, ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
def configure_configuration() -> ConfigurationABC:
|
def configure_configuration() -> ConfigurationABC:
|
||||||
|
@ -11,9 +11,9 @@ class StartupTemplate(TemplateFileABC):
|
|||||||
self._name = 'startup.py'
|
self._name = 'startup.py'
|
||||||
self._path = path
|
self._path = path
|
||||||
self._value = textwrap.dedent("""\
|
self._value = textwrap.dedent("""\
|
||||||
from cpl.application import StartupABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
|
|
||||||
|
|
||||||
class Startup(StartupABC):
|
class Startup(StartupABC):
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.application.application_abc import ApplicationABC
|
from cpl_core.application.application_abc import ApplicationABC
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.console_argument import ConsoleArgument
|
||||||
from cpl.console.console import Console
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.dependency_injection import ServiceProviderABC
|
from cpl_core.console.console import Console
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
from cpl_cli.command.add_service import AddService
|
from cpl_cli.command.add_service import AddService
|
||||||
from cpl_cli.command.build_service import BuildService
|
from cpl_cli.command.build_service import BuildService
|
||||||
|
from cpl_cli.command.custom_script_service import CustomScriptService
|
||||||
from cpl_cli.command.generate_service import GenerateService
|
from cpl_cli.command.generate_service import GenerateService
|
||||||
from cpl_cli.command.install_service import InstallService
|
from cpl_cli.command.install_service import InstallService
|
||||||
from cpl_cli.command.new_service import NewService
|
from cpl_cli.command.new_service import NewService
|
||||||
@ -16,6 +19,7 @@ from cpl_cli.command.uninstall_service import UninstallService
|
|||||||
from cpl_cli.command.update_service import UpdateService
|
from cpl_cli.command.update_service import UpdateService
|
||||||
from cpl_cli.command_handler_service import CommandHandler
|
from cpl_cli.command_handler_service import CommandHandler
|
||||||
from cpl_cli.command_model import CommandModel
|
from cpl_cli.command_model import CommandModel
|
||||||
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
from cpl_cli.error import Error
|
from cpl_cli.error import Error
|
||||||
from cpl_cli.command.help_service import HelpService
|
from cpl_cli.command.help_service import HelpService
|
||||||
from cpl_cli.command.version_service import VersionService
|
from cpl_cli.command.version_service import VersionService
|
||||||
@ -48,6 +52,11 @@ class CLI(ApplicationABC):
|
|||||||
self._command_handler.add_command(CommandModel('update', ['u', 'U'], UpdateService, False, True, True))
|
self._command_handler.add_command(CommandModel('update', ['u', 'U'], UpdateService, False, True, True))
|
||||||
self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False, False, False))
|
self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False, False, False))
|
||||||
|
|
||||||
|
if os.path.isfile(os.path.join(self._environment.working_directory, 'cpl-workspace.json')):
|
||||||
|
workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings)
|
||||||
|
for script in workspace.scripts:
|
||||||
|
self._command_handler.add_command(CommandModel(script, [], CustomScriptService, True, True, False))
|
||||||
|
|
||||||
self._command_handler.add_command(CommandModel('--help', ['-h', '-H'], HelpService, False, False, False))
|
self._command_handler.add_command(CommandModel('--help', ['-h', '-H'], HelpService, False, False, False))
|
||||||
self._options.append('--help')
|
self._options.append('--help')
|
||||||
|
|
||||||
@ -100,6 +109,10 @@ class CLI(ApplicationABC):
|
|||||||
for arg in result_args:
|
for arg in result_args:
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
|
|
||||||
|
else:
|
||||||
|
Error.error(f'Unexpected command')
|
||||||
|
return
|
||||||
|
|
||||||
if command is None:
|
if command is None:
|
||||||
Error.error(f'Expected command')
|
Error.error(f'Expected command')
|
||||||
return
|
return
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl_cli.cli_settings_name_enum import CLISettingsNameEnum
|
from cpl_cli.cli_settings_name_enum import CLISettingsNameEnum
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ from .publish_service import PublishService
|
|||||||
from .version_service import VersionService
|
from .version_service import VersionService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -3,9 +3,9 @@ import os
|
|||||||
import textwrap
|
import textwrap
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
|
39
src/cpl_cli/command/custom_script_service.py
Normal file
39
src/cpl_cli/command/custom_script_service.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
|
from cpl_core.console.console import Console
|
||||||
|
from cpl_cli.command_abc import CommandABC
|
||||||
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
|
|
||||||
|
|
||||||
|
class CustomScriptService(CommandABC):
|
||||||
|
|
||||||
|
def __init__(self, config: ConfigurationABC, ws: WorkspaceSettings):
|
||||||
|
"""
|
||||||
|
Service for CLI scripts
|
||||||
|
"""
|
||||||
|
CommandABC.__init__(self)
|
||||||
|
|
||||||
|
self._config = config
|
||||||
|
self._workspace = ws
|
||||||
|
|
||||||
|
@property
|
||||||
|
def help_message(self) -> str:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def run(self, args: list[str]):
|
||||||
|
cmd = args[0] if len(args) > 0 else self._config.additional_arguments[0]
|
||||||
|
|
||||||
|
for script in self._workspace.scripts:
|
||||||
|
if script == cmd:
|
||||||
|
command = self._workspace.scripts[script]
|
||||||
|
try:
|
||||||
|
run_command = []
|
||||||
|
for word in command.split(' '):
|
||||||
|
run_command.append(word)
|
||||||
|
|
||||||
|
subprocess.run(run_command)
|
||||||
|
except Exception as e:
|
||||||
|
Console.error(str(e))
|
@ -2,10 +2,10 @@ import os
|
|||||||
import textwrap
|
import textwrap
|
||||||
from collections import Callable
|
from collections import Callable
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli._templates.generate.init_template import InitTemplate
|
from cpl_cli._templates.generate.init_template import InitTemplate
|
||||||
from cpl_cli._templates.generate.abc_template import ABCTemplate
|
from cpl_cli._templates.generate.abc_template import ABCTemplate
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import textwrap
|
import textwrap
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl_cli.command_handler_service import CommandHandler
|
from cpl_cli.command_handler_service import CommandHandler
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ import textwrap
|
|||||||
|
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.utils.pip import Pip
|
from cpl_core.utils.pip import Pip
|
||||||
from cpl_cli.cli_settings import CLISettings
|
from cpl_cli.cli_settings import CLISettings
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
|
@ -5,12 +5,12 @@ from typing import Optional
|
|||||||
|
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
import cpl
|
import cpl_core
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
|
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
|
||||||
@ -96,7 +96,7 @@ class NewService(CommandABC):
|
|||||||
ProjectSettingsNameEnum.license_name.value: '',
|
ProjectSettingsNameEnum.license_name.value: '',
|
||||||
ProjectSettingsNameEnum.license_description.value: '',
|
ProjectSettingsNameEnum.license_description.value: '',
|
||||||
ProjectSettingsNameEnum.dependencies.value: [
|
ProjectSettingsNameEnum.dependencies.value: [
|
||||||
f'sh_cpl=={version.parse(cpl.__version__)}'
|
f'sh_cpl>={version.parse(cpl_core.__version__)}'
|
||||||
],
|
],
|
||||||
ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}',
|
ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}',
|
||||||
ProjectSettingsNameEnum.python_path.value: {
|
ProjectSettingsNameEnum.python_path.value: {
|
||||||
|
@ -3,10 +3,10 @@ import shutil
|
|||||||
import json
|
import json
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration import WorkspaceSettings, WorkspaceSettingsNameEnum
|
from cpl_cli.configuration import WorkspaceSettings, WorkspaceSettingsNameEnum
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.utils.pip import Pip
|
from cpl_core.utils.pip import Pip
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
|
@ -3,11 +3,11 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.utils.pip import Pip
|
from cpl_core.utils.pip import Pip
|
||||||
from cpl_cli.cli_settings import CLISettings
|
from cpl_cli.cli_settings import CLISettings
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration import BuildSettings
|
from cpl_cli.configuration import BuildSettings
|
||||||
|
@ -4,10 +4,10 @@ import platform
|
|||||||
import pkg_resources
|
import pkg_resources
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import cpl
|
|
||||||
import cpl_cli
|
import cpl_cli
|
||||||
from cpl.console.console import Console
|
import cpl_core
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.console import Console
|
||||||
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +45,14 @@ class VersionService(CommandABC):
|
|||||||
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
|
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
|
||||||
|
|
||||||
Console.write_line('\nCPL packages:')
|
Console.write_line('\nCPL packages:')
|
||||||
|
cpl_packages = [
|
||||||
|
'cpl_core',
|
||||||
|
'cpl_cli',
|
||||||
|
'cpl_query'
|
||||||
|
]
|
||||||
packages = []
|
packages = []
|
||||||
for importer, modname, is_pkg in pkgutil.iter_modules(cpl.__path__):
|
for modname in cpl_packages:
|
||||||
module = importer.find_module(modname).load_module(modname)
|
module = pkgutil.find_loader(modname).load_module(modname)
|
||||||
if '__version__' in dir(module):
|
if '__version__' in dir(module):
|
||||||
packages.append([f'{modname}', module.__version__])
|
packages.append([f'{modname}', module.__version__])
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@ import os
|
|||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
|
from cpl_cli.command.custom_script_service import CustomScriptService
|
||||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
from cpl_cli.error import Error
|
from cpl_cli.error import Error
|
||||||
from cpl_cli.command_model import CommandModel
|
from cpl_cli.command_model import CommandModel
|
||||||
@ -57,7 +58,6 @@ class CommandHandler(ABC):
|
|||||||
workspace: Optional[WorkspaceSettings] = None
|
workspace: Optional[WorkspaceSettings] = None
|
||||||
|
|
||||||
if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')):
|
if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')):
|
||||||
self._config.add_json_file('cpl-workspace.json', optional=True, output=False)
|
|
||||||
workspace = self._config.get_configuration(WorkspaceSettings)
|
workspace = self._config.get_configuration(WorkspaceSettings)
|
||||||
|
|
||||||
if command.is_project_needed:
|
if command.is_project_needed:
|
||||||
@ -111,5 +111,27 @@ class CommandHandler(ABC):
|
|||||||
|
|
||||||
self._config.add_json_file(project_json, optional=True, output=False)
|
self._config.add_json_file(project_json, optional=True, output=False)
|
||||||
|
|
||||||
self._services.get_service(command.command).run(args)
|
# pre scripts
|
||||||
Console.write('\n')
|
Console.write('\n')
|
||||||
|
self._handle_pre_or_post_scripts(True, workspace, command)
|
||||||
|
self._services.get_service(command.command).run(args)
|
||||||
|
# post scripts
|
||||||
|
Console.write('\n\n')
|
||||||
|
self._handle_pre_or_post_scripts(False, workspace, command)
|
||||||
|
Console.write('\n')
|
||||||
|
|
||||||
|
def _handle_pre_or_post_scripts(self, pre: bool, workspace: WorkspaceSettings, command: CommandModel):
|
||||||
|
script_type = 'pre-' if pre else 'post-'
|
||||||
|
if workspace is not None and len(workspace.scripts) > 0:
|
||||||
|
for script in workspace.scripts:
|
||||||
|
if script_type in script and script.split(script_type)[1] == command.name:
|
||||||
|
script_name = script
|
||||||
|
script_cmd = workspace.scripts[script]
|
||||||
|
if script_cmd in workspace.scripts:
|
||||||
|
script_name = workspace.scripts[script]
|
||||||
|
|
||||||
|
css: CustomScriptService = self._services.get_service(CustomScriptService)
|
||||||
|
if css is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
css.run([script_name])
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings
|
|||||||
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -2,9 +2,9 @@ import sys
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
|
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
|
||||||
from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
|
from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
|
||||||
|
|
||||||
@ -76,7 +76,11 @@ class BuildSettings(ConfigurationModelABC):
|
|||||||
self._included = settings[BuildSettingsNameEnum.included.value]
|
self._included = settings[BuildSettingsNameEnum.included.value]
|
||||||
self._excluded = settings[BuildSettingsNameEnum.excluded.value]
|
self._excluded = settings[BuildSettingsNameEnum.excluded.value]
|
||||||
self._package_data = settings[BuildSettingsNameEnum.package_data.value]
|
self._package_data = settings[BuildSettingsNameEnum.package_data.value]
|
||||||
self._project_references = settings[BuildSettingsNameEnum.project_references.value]
|
|
||||||
|
if BuildSettingsNameEnum.project_references.value in settings:
|
||||||
|
self._project_references = settings[BuildSettingsNameEnum.project_references.value]
|
||||||
|
else:
|
||||||
|
self._project_references = []
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
self._source_path = str(self._source_path).replace('/', '\\')
|
self._source_path = str(self._source_path).replace('/', '\\')
|
||||||
|
@ -3,9 +3,9 @@ import sys
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl_cli.configuration.version_settings import VersionSettings
|
from cpl_cli.configuration.version_settings import VersionSettings
|
||||||
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum
|
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum
|
||||||
from cpl_cli.error import Error
|
from cpl_cli.error import Error
|
||||||
@ -127,7 +127,11 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
|
|
||||||
self._python_executable = path
|
self._python_executable = path
|
||||||
|
|
||||||
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
if ProjectSettingsNameEnum.classifiers.value:
|
||||||
|
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
||||||
|
else:
|
||||||
|
self._classifiers = []
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||||
Console.write_line(
|
Console.write_line(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||||
|
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ class WorkspaceSettings(ConfigurationModelABC):
|
|||||||
|
|
||||||
self._default_project: Optional[str] = None
|
self._default_project: Optional[str] = None
|
||||||
self._projects: dict[str, str] = {}
|
self._projects: dict[str, str] = {}
|
||||||
|
self._scripts: dict[str, str] = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_project(self) -> str:
|
def default_project(self) -> str:
|
||||||
@ -22,10 +23,19 @@ class WorkspaceSettings(ConfigurationModelABC):
|
|||||||
def projects(self) -> dict[str, str]:
|
def projects(self) -> dict[str, str]:
|
||||||
return self._projects
|
return self._projects
|
||||||
|
|
||||||
|
@property
|
||||||
|
def scripts(self):
|
||||||
|
return self._scripts
|
||||||
|
|
||||||
def from_dict(self, settings: dict):
|
def from_dict(self, settings: dict):
|
||||||
try:
|
try:
|
||||||
self._default_project = settings[WorkspaceSettingsNameEnum.default_project.value]
|
self._default_project = settings[WorkspaceSettingsNameEnum.default_project.value]
|
||||||
self._projects = settings[WorkspaceSettingsNameEnum.projects.value]
|
self._projects = settings[WorkspaceSettingsNameEnum.projects.value]
|
||||||
|
|
||||||
|
if WorkspaceSettingsNameEnum.scripts.value in settings:
|
||||||
|
self._scripts = settings[WorkspaceSettingsNameEnum.scripts.value]
|
||||||
|
else:
|
||||||
|
self._scripts = {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
|
Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
|
||||||
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
||||||
|
@ -5,3 +5,4 @@ class WorkspaceSettingsNameEnum(Enum):
|
|||||||
|
|
||||||
default_project = 'DefaultProject'
|
default_project = 'DefaultProject'
|
||||||
projects = 'Projects'
|
projects = 'Projects'
|
||||||
|
scripts = 'Scripts'
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"Name": "sh_cpl-cli",
|
"Name": "sh_cpl-cli",
|
||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2021",
|
"Major": "2021",
|
||||||
"Minor": "4",
|
"Minor": "10",
|
||||||
"Micro": "0.post3"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"sh_cpl>=2021.4.0.post1"
|
"sh_cpl-core>=2021.10.0"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
"PythonPath": {},
|
"PythonPath": {},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
|
|
||||||
|
|
||||||
class Error:
|
class Error:
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -6,8 +6,8 @@ import psutil as psutil
|
|||||||
from watchdog.events import FileSystemEventHandler
|
from watchdog.events import FileSystemEventHandler
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
from cpl_cli.live_server.live_server_thread import LiveServerThread
|
from cpl_cli.live_server.live_server_thread import LiveServerThread
|
||||||
|
@ -4,9 +4,9 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_cli.configuration import BuildSettings
|
from cpl_cli.configuration import BuildSettings
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from cpl.application.application_builder import ApplicationBuilder
|
from cpl_core.application.application_builder import ApplicationBuilder
|
||||||
from cpl_cli.cli import CLI
|
from cpl_cli.cli import CLI
|
||||||
from cpl_cli.startup import Startup
|
from cpl_cli.startup import Startup
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC
|
|||||||
from .publisher_service import PublisherService
|
from .publisher_service import PublisherService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -7,10 +7,10 @@ import setuptools
|
|||||||
from packaging import version
|
from packaging import version
|
||||||
from setuptools import sandbox
|
from setuptools import sandbox
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
from cpl_cli.publish.publisher_abc import PublisherABC
|
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post3'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post3')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
||||||
|
@ -2,9 +2,9 @@ import json
|
|||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||||
from cpl_cli.source_creator.template_builder import TemplateBuilder
|
from cpl_cli.source_creator.template_builder import TemplateBuilder
|
||||||
@ -43,7 +43,8 @@ class ConsoleBuilder:
|
|||||||
ws_dict = {
|
ws_dict = {
|
||||||
WorkspaceSettings.__name__: {
|
WorkspaceSettings.__name__: {
|
||||||
WorkspaceSettingsNameEnum.default_project.value: project_name,
|
WorkspaceSettingsNameEnum.default_project.value: project_name,
|
||||||
WorkspaceSettingsNameEnum.projects.value: projects
|
WorkspaceSettingsNameEnum.projects.value: projects,
|
||||||
|
WorkspaceSettingsNameEnum.scripts: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ import json
|
|||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.utils.string import String
|
from cpl_core.utils.string import String
|
||||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||||
from cpl_cli.source_creator.template_builder import TemplateBuilder
|
from cpl_cli.source_creator.template_builder import TemplateBuilder
|
||||||
@ -43,7 +43,8 @@ class LibraryBuilder:
|
|||||||
ws_dict = {
|
ws_dict = {
|
||||||
WorkspaceSettings.__name__: {
|
WorkspaceSettings.__name__: {
|
||||||
WorkspaceSettingsNameEnum.default_project.value: project_name,
|
WorkspaceSettingsNameEnum.default_project.value: project_name,
|
||||||
WorkspaceSettingsNameEnum.projects.value: projects
|
WorkspaceSettingsNameEnum.projects.value: projects,
|
||||||
|
WorkspaceSettingsNameEnum.scripts: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.application.startup_abc import StartupABC
|
from cpl_core.application.startup_abc import StartupABC
|
||||||
from cpl.configuration.console_argument import ConsoleArgument
|
from cpl_core.configuration.console_argument import ConsoleArgument
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC
|
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl_cli.command.add_service import AddService
|
from cpl_cli.command.add_service import AddService
|
||||||
from cpl_cli.command.build_service import BuildService
|
from cpl_cli.command.build_service import BuildService
|
||||||
|
from cpl_cli.command.custom_script_service import CustomScriptService
|
||||||
from cpl_cli.command.generate_service import GenerateService
|
from cpl_cli.command.generate_service import GenerateService
|
||||||
from cpl_cli.command.install_service import InstallService
|
from cpl_cli.command.install_service import InstallService
|
||||||
from cpl_cli.command.new_service import NewService
|
from cpl_cli.command.new_service import NewService
|
||||||
@ -18,34 +20,30 @@ from cpl_cli.command.update_service import UpdateService
|
|||||||
from cpl_cli.command_handler_service import CommandHandler
|
from cpl_cli.command_handler_service import CommandHandler
|
||||||
from cpl_cli.command.help_service import HelpService
|
from cpl_cli.command.help_service import HelpService
|
||||||
from cpl_cli.command.version_service import VersionService
|
from cpl_cli.command.version_service import VersionService
|
||||||
|
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||||
from cpl_cli.error import Error
|
from cpl_cli.error import Error
|
||||||
from cpl_cli.live_server.live_server_service import LiveServerService
|
from cpl_cli.live_server.live_server_service import LiveServerService
|
||||||
from cpl_cli.publish.publisher_service import PublisherService
|
from cpl_cli.publish.publisher_service import PublisherService
|
||||||
from cpl_cli.publish.publisher_abc import PublisherABC
|
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||||
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
|
|
||||||
|
|
||||||
class Startup(StartupABC):
|
class Startup(StartupABC):
|
||||||
|
|
||||||
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
|
def __init__(self):
|
||||||
StartupABC.__init__(self)
|
StartupABC.__init__(self)
|
||||||
|
|
||||||
self._configuration = config
|
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||||
self._env = self._configuration.environment
|
environment.set_runtime_directory(os.path.dirname(__file__))
|
||||||
self._services = services
|
configuration.argument_error_function = Error.error
|
||||||
|
|
||||||
self._env.set_runtime_directory(os.path.dirname(__file__))
|
configuration.add_environment_variables('PYTHON_')
|
||||||
|
configuration.add_environment_variables('CPL_')
|
||||||
|
configuration.add_json_file('appsettings.json', path=environment.runtime_directory, optional=False, output=False)
|
||||||
|
|
||||||
def configure_configuration(self) -> ConfigurationABC:
|
configuration.add_console_argument(ConsoleArgument('', 'add', ['a', 'a'], ' '))
|
||||||
self._configuration.argument_error_function = Error.error
|
configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], ''))
|
||||||
|
configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[
|
||||||
self._configuration.add_environment_variables('PYTHON_')
|
|
||||||
self._configuration.add_environment_variables('CPL_')
|
|
||||||
self._configuration.add_json_file('appsettings.json', path=self._env.runtime_directory,
|
|
||||||
optional=False, output=False)
|
|
||||||
|
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'add', ['a', 'a'], ' '))
|
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], ''))
|
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[
|
|
||||||
ConsoleArgument('', 'abc', ['a', 'A'], ' '),
|
ConsoleArgument('', 'abc', ['a', 'A'], ' '),
|
||||||
ConsoleArgument('', 'class', ['c', 'C'], ' '),
|
ConsoleArgument('', 'class', ['c', 'C'], ' '),
|
||||||
ConsoleArgument('', 'enum', ['e', 'E'], ' '),
|
ConsoleArgument('', 'enum', ['e', 'E'], ' '),
|
||||||
@ -53,46 +51,54 @@ class Startup(StartupABC):
|
|||||||
ConsoleArgument('', 'settings', ['st', 'ST'], ' '),
|
ConsoleArgument('', 'settings', ['st', 'ST'], ' '),
|
||||||
ConsoleArgument('', 'thread', ['t', 't'], ' ')
|
ConsoleArgument('', 'thread', ['t', 't'], ' ')
|
||||||
]))
|
]))
|
||||||
self._configuration.add_console_argument(
|
configuration.add_console_argument(
|
||||||
ConsoleArgument('', 'help', ['h', 'H'], ' ', is_value_token_optional=True)
|
ConsoleArgument('', 'help', ['h', 'H'], ' ', is_value_token_optional=True)
|
||||||
)
|
)
|
||||||
self._configuration.add_console_argument(
|
configuration.add_console_argument(
|
||||||
ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True)
|
ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True)
|
||||||
)
|
)
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[
|
configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[
|
||||||
ConsoleArgument('', 'console', ['c', 'C'], ' '),
|
ConsoleArgument('', 'console', ['c', 'C'], ' '),
|
||||||
ConsoleArgument('', 'library', ['l', 'L'], ' ')
|
ConsoleArgument('', 'library', ['l', 'L'], ' ')
|
||||||
]))
|
]))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], ''))
|
configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], ''))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'remove', ['r', 'R'], ' '))
|
configuration.add_console_argument(ConsoleArgument('', 'remove', ['r', 'R'], ' '))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], ''))
|
configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], ''))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' '))
|
configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' '))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], ''))
|
configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], ''))
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], ''))
|
configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], ''))
|
||||||
|
|
||||||
self._configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], ''))
|
configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], ''))
|
||||||
|
|
||||||
self._configuration.add_console_arguments(error=False)
|
if os.path.isfile(os.path.join(environment.working_directory, 'cpl-workspace.json')):
|
||||||
|
configuration.add_json_file('cpl-workspace.json', optional=True, output=False)
|
||||||
|
workspace: Optional[WorkspaceSettings] = configuration.get_configuration(WorkspaceSettings)
|
||||||
|
for script in workspace.scripts:
|
||||||
|
configuration.add_console_argument(
|
||||||
|
ConsoleArgument('', script, [], ' ', is_value_token_optional=True))
|
||||||
|
|
||||||
return self._configuration
|
configuration.add_console_arguments(error=False)
|
||||||
|
|
||||||
def configure_services(self) -> ServiceProviderABC:
|
return configuration
|
||||||
self._services.add_singleton(CommandHandler)
|
|
||||||
|
|
||||||
self._services.add_transient(PublisherABC, PublisherService)
|
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
self._services.add_transient(LiveServerService)
|
services.add_singleton(CommandHandler)
|
||||||
|
|
||||||
self._services.add_transient(AddService)
|
services.add_transient(PublisherABC, PublisherService)
|
||||||
self._services.add_transient(BuildService)
|
services.add_transient(LiveServerService)
|
||||||
self._services.add_transient(GenerateService)
|
|
||||||
self._services.add_transient(HelpService)
|
|
||||||
self._services.add_transient(InstallService)
|
|
||||||
self._services.add_transient(NewService)
|
|
||||||
self._services.add_transient(PublishService)
|
|
||||||
self._services.add_transient(RemoveService)
|
|
||||||
self._services.add_transient(StartService)
|
|
||||||
self._services.add_transient(UninstallService)
|
|
||||||
self._services.add_transient(UpdateService)
|
|
||||||
self._services.add_transient(VersionService)
|
|
||||||
|
|
||||||
return self._services.build_service_provider()
|
services.add_transient(AddService)
|
||||||
|
services.add_transient(BuildService)
|
||||||
|
services.add_transient(CustomScriptService)
|
||||||
|
services.add_transient(GenerateService)
|
||||||
|
services.add_transient(HelpService)
|
||||||
|
services.add_transient(InstallService)
|
||||||
|
services.add_transient(NewService)
|
||||||
|
services.add_transient(PublishService)
|
||||||
|
services.add_transient(RemoveService)
|
||||||
|
services.add_transient(StartService)
|
||||||
|
services.add_transient(UninstallService)
|
||||||
|
services.add_transient(UpdateService)
|
||||||
|
services.add_transient(VersionService)
|
||||||
|
|
||||||
|
return services.build_service_provider()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,15 +11,15 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl'
|
__title__ = 'cpl_core'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.application'
|
__title__ = 'cpl_core.application'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC
|
|||||||
from .startup_abc import StartupABC
|
from .startup_abc import StartupABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -1,10 +1,10 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl.environment import ApplicationEnvironmentABC
|
from cpl_core.environment import ApplicationEnvironmentABC
|
||||||
|
|
||||||
|
|
||||||
class ApplicationABC(ABC):
|
class ApplicationABC(ABC):
|
||||||
@ -12,9 +12,9 @@ class ApplicationABC(ABC):
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
config: :class:`cpl.configuration.configuration_abc.ConfigurationABC`
|
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
|
||||||
Contains object loaded from appsettings
|
Contains object loaded from appsettings
|
||||||
services: :class:`cpl.dependency_injection.service_provider_abc.ServiceProviderABC`
|
services: :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC`
|
||||||
Contains instances of prepared objects
|
Contains instances of prepared objects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class ApplicationABC(ABC):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
r"""Configure the application
|
r"""Configure the application
|
||||||
|
|
||||||
Called by :class:`cpl.application.application_abc.ApplicationABC.run`
|
Called by :class:`cpl_core.application.application_abc.ApplicationABC.run`
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -47,6 +47,6 @@ class ApplicationABC(ABC):
|
|||||||
def main(self):
|
def main(self):
|
||||||
r"""Custom entry point
|
r"""Custom entry point
|
||||||
|
|
||||||
Called by :class:`cpl.application.application_abc.ApplicationABC.run`
|
Called by :class:`cpl_core.application.application_abc.ApplicationABC.run`
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
52
src/cpl_core/application/application_builder.py
Normal file
52
src/cpl_core/application/application_builder.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import types
|
||||||
|
from typing import Type, Optional, Callable
|
||||||
|
|
||||||
|
from cpl_core.application.application_abc import ApplicationABC
|
||||||
|
from cpl_core.application.application_builder_abc import ApplicationBuilderABC
|
||||||
|
from cpl_core.application.application_extension_abc import ApplicationExtensionABC
|
||||||
|
from cpl_core.application.startup_abc import StartupABC
|
||||||
|
from cpl_core.configuration.configuration import Configuration
|
||||||
|
from cpl_core.console import Console
|
||||||
|
from cpl_core.dependency_injection.service_collection import ServiceCollection
|
||||||
|
|
||||||
|
|
||||||
|
class ApplicationBuilder(ApplicationBuilderABC):
|
||||||
|
r"""This is class is used to build a object of :class:`cpl_core.application.application_abc.ApplicationABC`
|
||||||
|
|
||||||
|
Parameter
|
||||||
|
---------
|
||||||
|
app: Type[:class:`cpl_core.application.application_abc.ApplicationABC`]
|
||||||
|
Application to build
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, app: Type[ApplicationABC]):
|
||||||
|
ApplicationBuilderABC.__init__(self)
|
||||||
|
self._app = app
|
||||||
|
self._startup: Optional[StartupABC] = None
|
||||||
|
|
||||||
|
self._configuration = Configuration()
|
||||||
|
self._environment = self._configuration.environment
|
||||||
|
self._services = ServiceCollection(self._configuration)
|
||||||
|
|
||||||
|
self._extensions: list[Callable] = []
|
||||||
|
|
||||||
|
def use_startup(self, startup: Type[StartupABC]):
|
||||||
|
self._startup = startup()
|
||||||
|
|
||||||
|
def use_extension(self, extension: Type[ApplicationExtensionABC]):
|
||||||
|
if extension not in self._extensions:
|
||||||
|
self._extensions.append(extension)
|
||||||
|
|
||||||
|
def build(self) -> ApplicationABC:
|
||||||
|
if self._startup is not None:
|
||||||
|
self._startup.configure_configuration(self._configuration, self._environment)
|
||||||
|
self._startup.configure_services(self._services, self._environment)
|
||||||
|
|
||||||
|
config = self._configuration
|
||||||
|
services = self._services.build_service_provider()
|
||||||
|
|
||||||
|
for ex in self._extensions:
|
||||||
|
extension = ex()
|
||||||
|
extension.run(config, services)
|
||||||
|
|
||||||
|
return self._app(config, services)
|
@ -1,12 +1,12 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
from cpl.application.application_abc import ApplicationABC
|
from cpl_core.application.application_abc import ApplicationABC
|
||||||
from cpl.application.startup_abc import StartupABC
|
from cpl_core.application.startup_abc import StartupABC
|
||||||
|
|
||||||
|
|
||||||
class ApplicationBuilderABC(ABC):
|
class ApplicationBuilderABC(ABC):
|
||||||
r"""ABC for the :class:`cpl.application.application_builder.ApplicationBuilder`"""
|
r"""ABC for the :class:`cpl_core.application.application_builder.ApplicationBuilder`"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
@ -18,7 +18,7 @@ class ApplicationBuilderABC(ABC):
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
startup: Type[:class:`cpl.application.startup_abc.StartupABC`]
|
startup: Type[:class:`cpl_core.application.startup_abc.StartupABC`]
|
||||||
Startup class to use
|
Startup class to use
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
@ -29,6 +29,6 @@ class ApplicationBuilderABC(ABC):
|
|||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Object of :class:`cpl.application.application_abc.ApplicationABC`
|
Object of :class:`cpl_core.application.application_abc.ApplicationABC`
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
13
src/cpl_core/application/application_extension_abc.py
Normal file
13
src/cpl_core/application/application_extension_abc.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
from cpl_core.configuration import ConfigurationABC
|
||||||
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
|
class ApplicationExtensionABC(ABC):
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def __init__(self): pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass
|
44
src/cpl_core/application/startup_abc.py
Normal file
44
src/cpl_core/application/startup_abc.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
|
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC
|
||||||
|
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
|
|
||||||
|
|
||||||
|
class StartupABC(ABC):
|
||||||
|
r"""ABC for the startup class"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def __init__(self, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC:
|
||||||
|
r"""Creates configuration of application
|
||||||
|
|
||||||
|
Parameter
|
||||||
|
---------
|
||||||
|
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
|
||||||
|
env: :class:`cpl_core.environment.application_environment_abc`
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
Object of :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def configure_services(self, service: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC:
|
||||||
|
r"""Creates service provider
|
||||||
|
|
||||||
|
Parameter
|
||||||
|
---------
|
||||||
|
services: :class:`cpl_core.dependency_injection.service_collection_abc`
|
||||||
|
env: :class:`cpl_core.environment.application_environment_abc`
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
Object of :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC`
|
||||||
|
"""
|
||||||
|
pass
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.configuration'
|
__title__ = 'cpl_core.configuration'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum
|
|||||||
from .console_argument import ConsoleArgument
|
from .console_argument import ConsoleArgument
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -4,15 +4,15 @@ import sys
|
|||||||
from collections import Callable
|
from collections import Callable
|
||||||
from typing import Union, Type, Optional
|
from typing import Union, Type, Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.configuration.configuration_variable_name_enum import ConfigurationVariableNameEnum
|
from cpl_core.configuration.configuration_variable_name_enum import ConfigurationVariableNameEnum
|
||||||
from cpl.configuration.console_argument import ConsoleArgument
|
from cpl_core.configuration.console_argument import ConsoleArgument
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment import ApplicationEnvironment
|
from cpl_core.environment.application_environment import ApplicationEnvironment
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
from cpl_core.environment.environment_name_enum import EnvironmentNameEnum
|
||||||
|
|
||||||
|
|
||||||
class Configuration(ConfigurationABC):
|
class Configuration(ConfigurationABC):
|
||||||
@ -122,7 +122,7 @@ class Configuration(ConfigurationABC):
|
|||||||
---------
|
---------
|
||||||
argument: :class:`str`
|
argument: :class:`str`
|
||||||
Command as string
|
Command as string
|
||||||
argument_type: :class:`cpl.configuration.console_argument.ConsoleArgument`
|
argument_type: :class:`cpl_core.configuration.console_argument.ConsoleArgument`
|
||||||
Command type as ConsoleArgument
|
Command type as ConsoleArgument
|
||||||
next_arguments: list[:class:`str`]
|
next_arguments: list[:class:`str`]
|
||||||
Following arguments of argument
|
Following arguments of argument
|
@ -2,16 +2,16 @@ from abc import abstractmethod, ABC
|
|||||||
from collections import Callable
|
from collections import Callable
|
||||||
from typing import Type, Union, Optional
|
from typing import Type, Union, Optional
|
||||||
|
|
||||||
from cpl.configuration.console_argument import ConsoleArgument
|
from cpl_core.configuration.console_argument import ConsoleArgument
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationABC(ABC):
|
class ConfigurationABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
r"""ABC for the :class:`cpl.configuration.configuration.Configuration`"""
|
r"""ABC for the :class:`cpl_core.configuration.configuration.Configuration`"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -47,7 +47,7 @@ class ConfigurationABC(ABC):
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
argument: :class:`cpl.configuration.console_argument.ConsoleArgument`
|
argument: :class:`cpl_core.configuration.console_argument.ConsoleArgument`
|
||||||
Specifies the console argument
|
Specifies the console argument
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
@ -88,7 +88,7 @@ class ConfigurationABC(ABC):
|
|||||||
---------
|
---------
|
||||||
key_type: Union[:class:`str`, :class:`type`]
|
key_type: Union[:class:`str`, :class:`type`]
|
||||||
Type of the value
|
Type of the value
|
||||||
value: Union[:class:`str`, :class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]
|
value: Union[:class:`str`, :class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]
|
||||||
Object of the value
|
Object of the value
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
@ -99,11 +99,11 @@ class ConfigurationABC(ABC):
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
search_type: Union[:class:`str`, Type[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
search_type: Union[:class:`str`, Type[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
||||||
Type to search for
|
Type to search for
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Object of Union[:class:`str`, Callable[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
Object of Union[:class:`str`, Callable[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
@ -17,7 +17,7 @@ class ConsoleArgument:
|
|||||||
aliases: list[:class:`str`]
|
aliases: list[:class:`str`]
|
||||||
value_token: :class:`str`
|
value_token: :class:`str`
|
||||||
is_value_token_optional: :class:`bool`
|
is_value_token_optional: :class:`bool`
|
||||||
console_arguments: List[:class:`cpl.configuration.console_argument.ConsoleArgument`]
|
console_arguments: List[:class:`cpl_core.configuration.console_argument.ConsoleArgument`]
|
||||||
"""
|
"""
|
||||||
self._token = token
|
self._token = token
|
||||||
self._name = name
|
self._name = name
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.console'
|
__title__ = 'cpl_core.console'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum
|
|||||||
from .spinner_thread import SpinnerThread
|
from .spinner_thread import SpinnerThread
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -11,10 +11,10 @@ from pynput.keyboard import Key
|
|||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from termcolor import colored
|
from termcolor import colored
|
||||||
|
|
||||||
from cpl.console.background_color_enum import BackgroundColorEnum
|
from cpl_core.console.background_color_enum import BackgroundColorEnum
|
||||||
from cpl.console.console_call import ConsoleCall
|
from cpl_core.console.console_call import ConsoleCall
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.console.spinner_thread import SpinnerThread
|
from cpl_core.console.spinner_thread import SpinnerThread
|
||||||
|
|
||||||
|
|
||||||
class Console:
|
class Console:
|
||||||
@ -64,7 +64,7 @@ class Console:
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
|
color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
|
||||||
Background color of the console
|
Background color of the console
|
||||||
"""
|
"""
|
||||||
if type(color) is str:
|
if type(color) is str:
|
||||||
@ -78,7 +78,7 @@ class Console:
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
|
color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
|
||||||
Foreground color of the console
|
Foreground color of the console
|
||||||
"""
|
"""
|
||||||
if type(color) is str:
|
if type(color) is str:
|
||||||
@ -365,17 +365,17 @@ class Console:
|
|||||||
Message or header of the selection
|
Message or header of the selection
|
||||||
options: List[:class:`str`]
|
options: List[:class:`str`]
|
||||||
Selectable options
|
Selectable options
|
||||||
header_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
|
header_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`]
|
||||||
Foreground color of the header
|
Foreground color of the header
|
||||||
header_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
|
header_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
|
||||||
Background color of the header
|
Background color of the header
|
||||||
option_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
|
option_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`]
|
||||||
Foreground color of the options
|
Foreground color of the options
|
||||||
option_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
|
option_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
|
||||||
Background color of the options
|
Background color of the options
|
||||||
cursor_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
|
cursor_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`]
|
||||||
Foreground color of the cursor
|
Foreground color of the cursor
|
||||||
cursor_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
|
cursor_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
|
||||||
Background color of the cursor
|
Background color of the cursor
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
@ -423,13 +423,13 @@ class Console:
|
|||||||
Function to call
|
Function to call
|
||||||
args: :class:`list`
|
args: :class:`list`
|
||||||
Arguments of the function
|
Arguments of the function
|
||||||
text_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
|
text_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`]
|
||||||
Foreground color of the text
|
Foreground color of the text
|
||||||
spinner_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`]
|
spinner_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`]
|
||||||
Foreground color of the spinner
|
Foreground color of the spinner
|
||||||
text_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
|
text_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
|
||||||
Background color of the text
|
Background color of the text
|
||||||
spinner_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`]
|
spinner_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
|
||||||
Background color of the spinner
|
Background color of the spinner
|
||||||
kwargs: :class:`dict`
|
kwargs: :class:`dict`
|
||||||
Keyword arguments of the call
|
Keyword arguments of the call
|
@ -5,8 +5,8 @@ import time
|
|||||||
|
|
||||||
from termcolor import colored
|
from termcolor import colored
|
||||||
|
|
||||||
from cpl.console.background_color_enum import BackgroundColorEnum
|
from cpl_core.console.background_color_enum import BackgroundColorEnum
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
|
|
||||||
|
|
||||||
class SpinnerThread(threading.Thread):
|
class SpinnerThread(threading.Thread):
|
||||||
@ -16,9 +16,9 @@ class SpinnerThread(threading.Thread):
|
|||||||
---------
|
---------
|
||||||
msg_len: :class:`int`
|
msg_len: :class:`int`
|
||||||
Length of the message
|
Length of the message
|
||||||
foreground_color: :class:`cpl.console.foreground_color.ForegroundColorEnum`
|
foreground_color: :class:`cpl_core.console.foreground_color.ForegroundColorEnum`
|
||||||
Foreground color of the spinner
|
Foreground color of the spinner
|
||||||
background_color: :class:`cpl.console.background_color.BackgroundColorEnum`
|
background_color: :class:`cpl_core.console.background_color.BackgroundColorEnum`
|
||||||
Background color of the spinner
|
Background color of the spinner
|
||||||
"""
|
"""
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"ProjectSettings": {
|
"ProjectSettings": {
|
||||||
"Name": "sh_cpl",
|
"Name": "sh_cpl-core",
|
||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2021",
|
"Major": "2021",
|
||||||
"Minor": "4",
|
"Minor": "10",
|
||||||
"Micro": "0.post2"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.database'
|
__title__ = 'cpl_core.database'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings
|
|||||||
from .database_settings_name_enum import DatabaseSettingsNameEnum
|
from .database_settings_name_enum import DatabaseSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.database.connection'
|
__title__ = 'cpl_core.database.connection'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection
|
|||||||
from .database_connection_abc import DatabaseConnectionABC
|
from .database_connection_abc import DatabaseConnectionABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -3,10 +3,10 @@ from typing import Optional
|
|||||||
from sqlalchemy import engine, create_engine
|
from sqlalchemy import engine, create_engine
|
||||||
from sqlalchemy.orm import Session, sessionmaker
|
from sqlalchemy.orm import Session, sessionmaker
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.database.connection.database_connection_abc import DatabaseConnectionABC
|
from cpl_core.database.connection.database_connection_abc import DatabaseConnectionABC
|
||||||
from cpl.database.database_settings import DatabaseSettings
|
from cpl_core.database.database_settings import DatabaseSettings
|
||||||
|
|
||||||
|
|
||||||
class DatabaseConnection(DatabaseConnectionABC):
|
class DatabaseConnection(DatabaseConnectionABC):
|
||||||
@ -14,7 +14,7 @@ class DatabaseConnection(DatabaseConnectionABC):
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
database_settings: :class:`cpl.database.database_settings.DatabaseSettings`
|
database_settings: :class:`cpl_core.database.database_settings.DatabaseSettings`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, database_settings: DatabaseSettings):
|
def __init__(self, database_settings: DatabaseSettings):
|
@ -5,7 +5,7 @@ from sqlalchemy.orm import Session
|
|||||||
|
|
||||||
|
|
||||||
class DatabaseConnectionABC(ABC):
|
class DatabaseConnectionABC(ABC):
|
||||||
r"""ABC for the :class:`cpl.database.connection.database_connection.DatabaseConnection`"""
|
r"""ABC for the :class:`cpl_core.database.connection.database_connection.DatabaseConnection`"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self): pass
|
def __init__(self): pass
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sh_cpl sh-edraft Common Python library
|
sh_cpl-core sh-edraft Common Python library
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sh-edraft Common Python library
|
sh-edraft Common Python library
|
||||||
@ -11,11 +11,11 @@ sh-edraft Common Python library
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'cpl.database.context'
|
__title__ = 'cpl_core.database.context'
|
||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.0.post2'
|
__version__ = '2021.10.0'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .database_context import DatabaseContext
|
|||||||
from .database_context_abc import DatabaseContextABC
|
from .database_context_abc import DatabaseContextABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='4', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='10', micro='0')
|
@ -1,13 +1,13 @@
|
|||||||
from sqlalchemy import engine, Table
|
from sqlalchemy import engine, Table
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.database.connection.database_connection import DatabaseConnection
|
from cpl_core.database.connection.database_connection import DatabaseConnection
|
||||||
from cpl.database.connection.database_connection_abc import DatabaseConnectionABC
|
from cpl_core.database.connection.database_connection_abc import DatabaseConnectionABC
|
||||||
from cpl.database.context.database_context_abc import DatabaseContextABC
|
from cpl_core.database.context.database_context_abc import DatabaseContextABC
|
||||||
from cpl.database.database_settings import DatabaseSettings
|
from cpl_core.database.database_settings import DatabaseSettings
|
||||||
from cpl.database.database_model import DatabaseModel
|
from cpl_core.database.database_model import DatabaseModel
|
||||||
|
|
||||||
|
|
||||||
class DatabaseContext(DatabaseContextABC):
|
class DatabaseContext(DatabaseContextABC):
|
||||||
@ -15,7 +15,7 @@ class DatabaseContext(DatabaseContextABC):
|
|||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
database_settings: :class:`cpl.database.database_settings.DatabaseSettings`
|
database_settings: :class:`cpl_core.database.database_settings.DatabaseSettings`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, database_settings: DatabaseSettings):
|
def __init__(self, database_settings: DatabaseSettings):
|
@ -5,7 +5,7 @@ from sqlalchemy.orm import Session
|
|||||||
|
|
||||||
|
|
||||||
class DatabaseContextABC(ABC):
|
class DatabaseContextABC(ABC):
|
||||||
r"""ABC for the :class:`cpl.database.context.database_context.DatabaseContext`"""
|
r"""ABC for the :class:`cpl_core.database.context.database_context.DatabaseContext`"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
@ -1,10 +1,10 @@
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.database.database_settings_name_enum import DatabaseSettingsNameEnum
|
from cpl_core.database.database_settings_name_enum import DatabaseSettingsNameEnum
|
||||||
|
|
||||||
|
|
||||||
class DatabaseSettings(ConfigurationModelABC):
|
class DatabaseSettings(ConfigurationModelABC):
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user