2022.10.11 - Added migrations to update command #114 #117
@ -15,7 +15,7 @@ __title__ = 'cpl_cli'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .main import main
|
||||
from .startup import Startup
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.build'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.generate'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source.name'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source.tests'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source.name'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source.tests'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest.source'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest.source.name'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.publish'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"CLI": {
|
||||
"PipPath": "https://pip-exp.sh-edraft.de"
|
||||
"PipPath": "https://pip.sh-edraft.de"
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -29,4 +29,4 @@ from .publish_service import PublishService
|
||||
from .version_service import VersionService
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -4,6 +4,7 @@ import subprocess
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.configuration.venv_helper_service import VenvHelper
|
||||
from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC
|
||||
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl_core.console.console import Console
|
||||
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||
@ -23,7 +24,8 @@ class UpdateService(CommandABC):
|
||||
env: ApplicationEnvironmentABC,
|
||||
build_settings: BuildSettings,
|
||||
project_settings: ProjectSettings,
|
||||
cli_settings: CLISettings):
|
||||
cli_settings: CLISettings,
|
||||
migrations: MigrationServiceABC):
|
||||
"""
|
||||
Service for the CLI command update
|
||||
:param config:
|
||||
@ -39,6 +41,7 @@ class UpdateService(CommandABC):
|
||||
self._build_settings = build_settings
|
||||
self._project_settings = project_settings
|
||||
self._cli_settings = cli_settings
|
||||
self._migrations = migrations
|
||||
self._is_simulation = False
|
||||
|
||||
self._project_file = f'{self._project_settings.name}.json'
|
||||
@ -56,7 +59,7 @@ class UpdateService(CommandABC):
|
||||
:return:
|
||||
"""
|
||||
dependencies = []
|
||||
for package in self._project_settings.dependencies:
|
||||
for package in [*self._project_settings.dependencies, *self._project_settings.dev_dependencies]:
|
||||
name = package
|
||||
if '==' in package:
|
||||
name = package.split('==')[0]
|
||||
@ -105,6 +108,15 @@ class UpdateService(CommandABC):
|
||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||
)
|
||||
|
||||
if 'cpl-cli' in [y for x, y in dependencies]:
|
||||
import cpl_cli
|
||||
|
||||
Console.spinner(
|
||||
'Running migrations', self._migrations.migrate_from, cpl_cli.__version__,
|
||||
text_foreground_color=ForegroundColorEnum.green,
|
||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||
)
|
||||
|
||||
Console.write_line(f'Found {len(self._project_settings.dependencies)} dependencies.')
|
||||
|
||||
@staticmethod
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -31,4 +31,4 @@ from .workspace_settings import WorkspaceSettings
|
||||
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "2022",
|
||||
"Minor": "10",
|
||||
"Micro": "rc2"
|
||||
"Micro": "11"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
@ -16,7 +16,7 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.10.rc2"
|
||||
"cpl-core>=2022.10.11"
|
||||
],
|
||||
"DevDependencies": [],
|
||||
"PythonVersion": ">=3.10",
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.live_server'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -5,6 +5,7 @@ import pkg_resources
|
||||
from cpl_cli.cli import CLI
|
||||
from cpl_cli.startup import Startup
|
||||
from cpl_cli.startup_argument_extension import StartupArgumentExtension
|
||||
from cpl_cli.startup_migration_extension import StartupMigrationExtension
|
||||
from cpl_cli.startup_workspace_extension import StartupWorkspaceExtension
|
||||
from cpl_core.application.application_builder import ApplicationBuilder
|
||||
from cpl_core.application.startup_extension_abc import StartupExtensionABC
|
||||
@ -34,6 +35,7 @@ def main():
|
||||
app_builder.use_startup(Startup)
|
||||
app_builder.use_extension(StartupWorkspaceExtension)
|
||||
app_builder.use_extension(StartupArgumentExtension)
|
||||
app_builder.use_extension(StartupMigrationExtension)
|
||||
for extension in get_startup_extensions():
|
||||
app_builder.use_extension(extension)
|
||||
|
||||
|
26
src/cpl_cli/migrations/__init__.py
Normal file
26
src/cpl_cli/migrations/__init__.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- 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.migrations'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
26
src/cpl_cli/migrations/base/__init__.py
Normal file
26
src/cpl_cli/migrations/base/__init__.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- 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.migrations.base'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
15
src/cpl_cli/migrations/base/migration_abc.py
Normal file
15
src/cpl_cli/migrations/base/migration_abc.py
Normal file
@ -0,0 +1,15 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class MigrationABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, version: str):
|
||||
self._version = version
|
||||
|
||||
@property
|
||||
def version(self) -> str:
|
||||
return self._version
|
||||
|
||||
@abstractmethod
|
||||
def migrate(self): pass
|
10
src/cpl_cli/migrations/base/migration_service_abc.py
Normal file
10
src/cpl_cli/migrations/base/migration_service_abc.py
Normal file
@ -0,0 +1,10 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class MigrationServiceABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
def migrate_from(self, version: str): pass
|
11
src/cpl_cli/migrations/migration_2022_10.py
Normal file
11
src/cpl_cli/migrations/migration_2022_10.py
Normal file
@ -0,0 +1,11 @@
|
||||
from cpl_cli.migrations.base.migration_abc import MigrationABC
|
||||
|
||||
|
||||
class Migration202210(MigrationABC):
|
||||
|
||||
def __init__(self):
|
||||
MigrationABC.__init__(self, '2022.10')
|
||||
|
||||
def migrate(self):
|
||||
# This migration could be deleted, but stays as an example.
|
||||
pass
|
26
src/cpl_cli/migrations/service/__init__.py
Normal file
26
src/cpl_cli/migrations/service/__init__.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- 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.migrations.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
21
src/cpl_cli/migrations/service/migration_service.py
Normal file
21
src/cpl_cli/migrations/service/migration_service.py
Normal file
@ -0,0 +1,21 @@
|
||||
from packaging import version
|
||||
|
||||
from cpl_cli.migrations.base.migration_abc import MigrationABC
|
||||
from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class MigrationService(MigrationServiceABC):
|
||||
|
||||
def __init__(self, services: ServiceProviderABC):
|
||||
MigrationServiceABC.__init__(self)
|
||||
|
||||
self._services = services
|
||||
|
||||
def migrate_from(self, _v: str):
|
||||
for migration_type in MigrationABC.__subclasses__():
|
||||
migration: MigrationABC = self._services.get_service(migration_type)
|
||||
if version.parse(migration.version) <= version.parse(_v):
|
||||
continue
|
||||
|
||||
migration.migrate()
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .publisher_abc import PublisherABC
|
||||
from .publisher_service import PublisherService
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.source_creator'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
28
src/cpl_cli/startup_migration_extension.py
Normal file
28
src/cpl_cli/startup_migration_extension.py
Normal file
@ -0,0 +1,28 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from cpl_cli.command.custom_script_service import CustomScriptService
|
||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||
from cpl_cli.migrations.base.migration_abc import MigrationABC
|
||||
from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC
|
||||
from cpl_cli.migrations.migration_2022_10 import Migration202210
|
||||
from cpl_cli.migrations.service.migration_service import MigrationService
|
||||
from cpl_core.application.startup_extension_abc import StartupExtensionABC
|
||||
from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
|
||||
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
|
||||
from cpl_core.utils.string import String
|
||||
|
||||
|
||||
class StartupMigrationExtension(StartupExtensionABC):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
pass
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
services.add_singleton(MigrationServiceABC, MigrationService)
|
||||
services.add_singleton(MigrationABC, Migration202210)
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.validators'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.application'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -29,4 +29,4 @@ from .startup_abc import StartupABC
|
||||
from .startup_extension_abc import StartupExtensionABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -35,4 +35,4 @@ from .validator_abc import ValidatorABC
|
||||
from .variable_argument import VariableArgument
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.console'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .foreground_color_enum import ForegroundColorEnum
|
||||
from .spinner_thread import SpinnerThread
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "2022",
|
||||
"Minor": "10",
|
||||
"Micro": "rc2"
|
||||
"Micro": "11"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.database'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -26,4 +26,4 @@ from .database_settings import DatabaseSettings
|
||||
from .table_abc import TableABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .database_connection import DatabaseConnection
|
||||
from .database_connection_abc import DatabaseConnectionABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .database_context import DatabaseContext
|
||||
from .database_context_abc import DatabaseContextABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -31,4 +31,4 @@ from .service_provider import ServiceProvider
|
||||
from .service_provider_abc import ServiceProviderABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -26,4 +26,4 @@ from .environment_name_enum import EnvironmentNameEnum
|
||||
from .application_environment import ApplicationEnvironment
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .logging_settings import LoggingSettings
|
||||
from .logging_settings_name_enum import LoggingSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -28,4 +28,4 @@ from .email_client_settings import EMailClientSettings
|
||||
from .email_client_settings_name_enum import EMailClientSettingsNameEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.pipes'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -30,4 +30,4 @@ from .to_camel_case_pipe import ToCamelCasePipe
|
||||
from .to_snake_case_pipe import ToSnakeCasePipe
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.time'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .time_format_settings import TimeFormatSettings
|
||||
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10rc2'
|
||||
__version__ = '2022.10.11'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -26,4 +26,4 @@ from .string import String
|
||||
from .pip import Pip
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='rc2')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='11')
|
||||
|
@ -74,9 +74,8 @@ class Pip:
|
||||
|
||||
if result is None:
|
||||
return None
|
||||
|
||||
for p in str(result.decode()).split('\n'):
|
||||
if p == package:
|
||||
if p.startswith(package):
|
||||
return p
|
||||
|
||||
return None
|
||||
|
@ -17,8 +17,8 @@
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core==2022.10rc2",
|
||||
"cpl-translation==2022.7.0.post2",
|
||||
"cpl-query==2022.7.0"
|
||||
"cpl-translation==2022.10rc2",
|
||||
"cpl-query==2022.10rc2"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli==2022.10.rc2"
|
||||
|
@ -61,7 +61,10 @@ class Application(ApplicationABC):
|
||||
if len(branch.split('.')) == 2:
|
||||
version[VersionSettingsNameEnum.micro.value] = f'0{suffix}'
|
||||
else:
|
||||
version[VersionSettingsNameEnum.micro.value] = f'{branch.split(".")[2]}{suffix}'
|
||||
branch_version = branch.split(".")[2]
|
||||
if '-#' in branch_version:
|
||||
branch_version = branch_version.split('-#')[0]
|
||||
version[VersionSettingsNameEnum.micro.value] = f'{branch_version}{suffix}'
|
||||
except Exception as e:
|
||||
Console.error(f'Branch {branch} does not contain valid version')
|
||||
return
|
||||
|
@ -16,7 +16,7 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.10.rc2",
|
||||
"cpl-core>=2022.10.11",
|
||||
"gitpython==3.1.27"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
|
@ -2,11 +2,8 @@ import json
|
||||
import os
|
||||
from string import ascii_letters
|
||||
|
||||
from cpl_core.utils import String
|
||||
|
||||
from cpl_core.console import Console
|
||||
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class VersionSetterService:
|
||||
|
Loading…
Reference in New Issue
Block a user