Compare commits
No commits in common. "95d8df5beae98c101babc394d5806d3f27d64116" and "2d9bb79af7e088def9a312eaf1fcf19318b4ecd3" have entirely different histories.
95d8df5bea
...
2d9bb79af7
@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
cpl-cli sh-edraft Common Python library CLI
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
sh-edraft Common Python library Command Line Interface
|
|
||||||
|
|
||||||
:copyright: (c) 2020 - 2022 sh-edraft.de
|
|
||||||
:license: MIT, see LICENSE for more details.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
__title__ = 'cpl_cli'
|
|
||||||
__author__ = 'Sven Heidemann'
|
|
||||||
__license__ = 'MIT'
|
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
|
||||||
__version__ = '2022.12.0'
|
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
|
|
||||||
# imports:
|
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
|
||||||
version_info = VersionInfo(major='2022', minor='12', micro='0')
|
|
@ -1,39 +0,0 @@
|
|||||||
import textwrap
|
|
||||||
|
|
||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class Application(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
code = """\
|
|
||||||
from cpl_core.application import ApplicationABC
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.console import Console
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(ApplicationABC):
|
|
||||||
|
|
||||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
|
||||||
ApplicationABC.__init__(self, config, services)
|
|
||||||
|
|
||||||
def configure(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def main(self):
|
|
||||||
Console.write_line('Hello World')
|
|
||||||
"""
|
|
||||||
x = self.build_code_str(code, Name=self._class_name)
|
|
||||||
return x
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'application',
|
|
||||||
['app', 'APP']
|
|
||||||
)
|
|
@ -1,35 +0,0 @@
|
|||||||
import textwrap
|
|
||||||
|
|
||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class ApplicationExtension(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
code = """\
|
|
||||||
from cpl_core.application import ApplicationExtensionABC
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(ApplicationExtensionABC):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
ApplicationExtensionABC.__init__(self)
|
|
||||||
|
|
||||||
def run(self, config: ConfigurationABC, services: ServiceProviderABC):
|
|
||||||
pass
|
|
||||||
"""
|
|
||||||
x = self.build_code_str(code, Name=self._class_name)
|
|
||||||
return x
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'application-extension',
|
|
||||||
['appex', 'APPEX']
|
|
||||||
)
|
|
@ -1,51 +0,0 @@
|
|||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
from cpl_core.utils import String
|
|
||||||
|
|
||||||
|
|
||||||
class Schematic(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, name: str, path: str, schematic: str):
|
|
||||||
GenerateSchematicABC.__init__(self, name, path, schematic)
|
|
||||||
self._name = f'schematic_{String.convert_to_snake_case(name)}.py'
|
|
||||||
self._path = '.cpl/'
|
|
||||||
self._class_name = String.convert_to_camel_case(name)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
code = """\
|
|
||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
import textwrap
|
|
||||||
code = textwrap.dedent(\"\"\"\\
|
|
||||||
from enum import Enum
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(Enum):
|
|
||||||
|
|
||||||
atr = 0
|
|
||||||
\"\"\")
|
|
||||||
return self.build_code_str(code, Name=self._class_name)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'$NameLower',
|
|
||||||
[]
|
|
||||||
)
|
|
||||||
"""
|
|
||||||
return self.build_code_str(code, Name=self._class_name)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'schematic',
|
|
||||||
['scheme', 'SCHEME']
|
|
||||||
)
|
|
@ -1,39 +0,0 @@
|
|||||||
import textwrap
|
|
||||||
|
|
||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class Startup(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
code = """\
|
|
||||||
from cpl_core.application import StartupABC
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
|
||||||
from cpl_core.environment import ApplicationEnvironment
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(StartupABC):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
StartupABC.__init__(self)
|
|
||||||
|
|
||||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
|
||||||
return configuration
|
|
||||||
|
|
||||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
|
||||||
return services.build_service_provider()
|
|
||||||
"""
|
|
||||||
x = self.build_code_str(code, Name=self._class_name)
|
|
||||||
return x
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'startup',
|
|
||||||
['stup', 'STUP']
|
|
||||||
)
|
|
@ -1,39 +0,0 @@
|
|||||||
import textwrap
|
|
||||||
|
|
||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class StartupExtension(GenerateSchematicABC):
|
|
||||||
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
code = """\
|
|
||||||
from cpl_core.application.startup_extension_abc import StartupExtensionABC
|
|
||||||
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC
|
|
||||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
|
||||||
|
|
||||||
|
|
||||||
class $Name(StartupExtensionABC):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
|
||||||
pass
|
|
||||||
"""
|
|
||||||
x = self.build_code_str(code, Name=self._class_name)
|
|
||||||
return x
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(
|
|
||||||
cls,
|
|
||||||
'startup-extension',
|
|
||||||
['stupex', 'STUPEX']
|
|
||||||
)
|
|
@ -1,26 +1 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
cpl-cli sh-edraft Common Python library CLI
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
sh-edraft Common Python library Command Line Interface
|
|
||||||
|
|
||||||
:copyright: (c) 2020 - 2022 sh-edraft.de
|
|
||||||
:license: MIT, see LICENSE for more details.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
__title__ = 'cpl_cli.abc'
|
|
||||||
__author__ = 'Sven Heidemann'
|
|
||||||
__license__ = 'MIT'
|
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
|
||||||
__version__ = '2022.12.0'
|
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
|
||||||
version_info = VersionInfo(major='2022', minor='12', micro='0')
|
|
||||||
|
@ -35,14 +35,11 @@ class GenerateService(CommandABC):
|
|||||||
self._env = self._config.environment
|
self._env = self._config.environment
|
||||||
self._schematics = {}
|
self._schematics = {}
|
||||||
|
|
||||||
for package_name, version in Dependencies.get_cpl_packages():
|
for package_name in Dependencies.get_cpl_packages():
|
||||||
if package_name == 'cpl-cli':
|
package = importlib.import_module(String.convert_to_snake_case(package_name[0]))
|
||||||
continue
|
|
||||||
package = importlib.import_module(String.convert_to_snake_case(package_name))
|
|
||||||
self._read_custom_schematics_from_path(os.path.dirname(package.__file__))
|
self._read_custom_schematics_from_path(os.path.dirname(package.__file__))
|
||||||
|
|
||||||
self._read_custom_schematics_from_path(self._env.working_directory)
|
self._read_custom_schematics_from_path(self._env.working_directory)
|
||||||
self._read_custom_schematics_from_path(self._env.runtime_directory)
|
|
||||||
|
|
||||||
if len(GenerateSchematicABC.__subclasses__()) == 0:
|
if len(GenerateSchematicABC.__subclasses__()) == 0:
|
||||||
Console.error(f'No schematics found in template directory: .cpl')
|
Console.error(f'No schematics found in template directory: .cpl')
|
||||||
|
@ -2,18 +2,18 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from cpl_cli.error import Error
|
from cpl_cli import Error
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
from cpl_cli.configuration import WorkspaceSettings
|
||||||
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.start_executable import StartExecutable
|
from cpl_cli.live_server.start_executable import StartExecutable
|
||||||
from cpl_cli.publish.publisher_service import PublisherService
|
from cpl_cli.publish import PublisherService
|
||||||
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl_core.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_core.utils.string import String
|
from cpl_core.utils import String
|
||||||
|
|
||||||
|
|
||||||
class RunService(CommandABC):
|
class RunService(CommandABC):
|
||||||
@ -91,7 +91,6 @@ class RunService(CommandABC):
|
|||||||
|
|
||||||
self._env.set_working_directory(self._src_dir)
|
self._env.set_working_directory(self._src_dir)
|
||||||
self._publisher.build()
|
self._publisher.build()
|
||||||
self._env.set_working_directory(self._src_dir)
|
|
||||||
self._src_dir = os.path.abspath(os.path.join(
|
self._src_dir = os.path.abspath(os.path.join(
|
||||||
self._src_dir,
|
self._src_dir,
|
||||||
self._build_settings.output_path,
|
self._build_settings.output_path,
|
||||||
|
@ -123,7 +123,7 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
self._python_path = settings[ProjectSettingsNameEnum.python_path.value]
|
self._python_path = settings[ProjectSettingsNameEnum.python_path.value]
|
||||||
|
|
||||||
if ProjectSettingsNameEnum.python_path.value in settings and sys.platform in settings[ProjectSettingsNameEnum.python_path.value]:
|
if ProjectSettingsNameEnum.python_path.value in settings and sys.platform in settings[ProjectSettingsNameEnum.python_path.value]:
|
||||||
path = f'{settings[ProjectSettingsNameEnum.python_path.value][sys.platform]}/bin/python'
|
path = settings[ProjectSettingsNameEnum.python_path.value][sys.platform]
|
||||||
if path == '' or path is None:
|
if path == '' or path is None:
|
||||||
Error.warn(f'{ProjectSettingsNameEnum.python_path.value} not set')
|
Error.warn(f'{ProjectSettingsNameEnum.python_path.value} not set')
|
||||||
path = sys.executable
|
path = sys.executable
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
cpl-cli sh-edraft Common Python library CLI
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
sh-edraft Common Python library Command Line Interface
|
|
||||||
|
|
||||||
:copyright: (c) 2020 - 2022 sh-edraft.de
|
|
||||||
:license: MIT, see LICENSE for more details.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
__title__ = 'cpl_cli.helper'
|
|
||||||
__author__ = 'Sven Heidemann'
|
|
||||||
__license__ = 'MIT'
|
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
|
||||||
__version__ = '2022.12.0'
|
|
||||||
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
|
|
||||||
# imports:
|
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
|
||||||
version_info = VersionInfo(major='2022', minor='12', micro='0')
|
|
@ -103,8 +103,9 @@ class LiveServerService(FileSystemEventHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._env.set_working_directory(self._src_dir)
|
self._env.set_working_directory(self._src_dir)
|
||||||
|
Console.disable()
|
||||||
self._publisher.build()
|
self._publisher.build()
|
||||||
self._env.set_working_directory(self._src_dir)
|
Console.enable()
|
||||||
self._wd = os.path.abspath(os.path.join(
|
self._wd = os.path.abspath(os.path.join(
|
||||||
self._src_dir,
|
self._src_dir,
|
||||||
self._build_settings.output_path,
|
self._build_settings.output_path,
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import threading
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from cpl_core.console.console import Console
|
from cpl_core.console.console import Console
|
||||||
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl_core.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 import BuildSettings
|
||||||
|
|
||||||
|
|
||||||
class StartExecutable:
|
class StartExecutable:
|
||||||
@ -42,10 +43,7 @@ class StartExecutable:
|
|||||||
self._env_vars['VIRTUAL_ENV'] = path
|
self._env_vars['VIRTUAL_ENV'] = path
|
||||||
|
|
||||||
def run(self, args: list[str], executable: str, path: str, output=True):
|
def run(self, args: list[str], executable: str, path: str, output=True):
|
||||||
self._executable = os.path.abspath(os.path.join(self._env.working_directory, executable))
|
self._executable = os.path.abspath(executable)
|
||||||
if not os.path.exists(self._executable):
|
|
||||||
Console.error(f'Executable not found')
|
|
||||||
return
|
|
||||||
|
|
||||||
main = self._build_settings.main
|
main = self._build_settings.main
|
||||||
if '.' in self._build_settings.main:
|
if '.' in self._build_settings.main:
|
||||||
|
Loading…
Reference in New Issue
Block a user