Merge pull request '2022.10.11 - Added migrations to update command #114' (#117) from 2022.10.11-#114 into 2022.10
Reviewed-on: #117 Closes 117
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user