Removed application runtime | Code refactoring p.2
This commit is contained in:
@@ -4,9 +4,9 @@ import subprocess
|
||||
|
||||
from packaging import version
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.utils.pip import Pip
|
||||
from cpl_cli.cli_settings import CLISettings
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
@@ -18,18 +18,18 @@ from cpl_cli.error import Error
|
||||
|
||||
class InstallService(CommandABC):
|
||||
|
||||
def __init__(self, runtime: ApplicationRuntimeABC, build_settings: BuildSettings, project_settings: ProjectSettings,
|
||||
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings, project_settings: ProjectSettings,
|
||||
cli_settings: CLISettings):
|
||||
"""
|
||||
Service for the CLI command install
|
||||
:param runtime:
|
||||
:param env:
|
||||
:param build_settings:
|
||||
:param project_settings:
|
||||
:param cli_settings:
|
||||
"""
|
||||
CommandABC.__init__(self)
|
||||
|
||||
self._runtime = runtime
|
||||
self._env = env
|
||||
self._build_settings = build_settings
|
||||
self._project_settings = project_settings
|
||||
self._cli_settings = cli_settings
|
||||
@@ -147,7 +147,7 @@ class InstallService(CommandABC):
|
||||
BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
|
||||
}
|
||||
|
||||
with open(os.path.join(self._runtime.working_directory, 'cpl.json'), 'w') as project_file:
|
||||
with open(os.path.join(self._env.working_directory, 'cpl.json'), 'w') as project_file:
|
||||
project_file.write(json.dumps(config, indent=2))
|
||||
project_file.close()
|
||||
|
||||
|
@@ -7,7 +7,6 @@ from packaging import version
|
||||
|
||||
import cpl
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.console.console import Console
|
||||
@@ -29,16 +28,15 @@ from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
class NewService(CommandABC):
|
||||
|
||||
def __init__(self, configuration: ConfigurationABC, runtime: ApplicationRuntimeABC):
|
||||
def __init__(self, configuration: ConfigurationABC):
|
||||
"""
|
||||
Service for the CLI command new
|
||||
:param configuration:
|
||||
:param runtime:
|
||||
"""
|
||||
CommandABC.__init__(self)
|
||||
|
||||
self._config = configuration
|
||||
self._runtime = runtime
|
||||
self._env = self._config.environment
|
||||
|
||||
self._project: ProjectSettings = ProjectSettings()
|
||||
self._project_dict = {}
|
||||
@@ -128,7 +126,7 @@ class NewService(CommandABC):
|
||||
Gets project path
|
||||
:return:
|
||||
"""
|
||||
project_path = os.path.join(self._runtime.working_directory, self._project.name)
|
||||
project_path = os.path.join(self._env.working_directory, self._project.name)
|
||||
if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0:
|
||||
Console.error('Project path is not empty\n')
|
||||
return None
|
||||
|
@@ -2,9 +2,9 @@ import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.utils.pip import Pip
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
from cpl_cli.configuration.build_settings import BuildSettings
|
||||
@@ -14,17 +14,17 @@ from cpl_cli.configuration.settings_helper import SettingsHelper
|
||||
|
||||
class UninstallService(CommandABC):
|
||||
|
||||
def __init__(self, runtime: ApplicationRuntimeABC, build_settings: BuildSettings,
|
||||
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings,
|
||||
project_settings: ProjectSettings):
|
||||
"""
|
||||
Service for the CLI command uninstall
|
||||
:param runtime:
|
||||
:param env:
|
||||
:param build_settings:
|
||||
:param project_settings:
|
||||
"""
|
||||
CommandABC.__init__(self)
|
||||
|
||||
self._runtime = runtime
|
||||
self._env = env
|
||||
|
||||
self._build_settings = build_settings
|
||||
self._project_settings = project_settings
|
||||
@@ -74,7 +74,7 @@ class UninstallService(CommandABC):
|
||||
ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings),
|
||||
BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
|
||||
}
|
||||
with open(os.path.join(self._runtime.working_directory, 'cpl.json'), 'w') as project_file:
|
||||
with open(os.path.join(self._env.working_directory, 'cpl.json'), 'w') as project_file:
|
||||
project_file.write(json.dumps(config, indent=2))
|
||||
project_file.close()
|
||||
|
||||
|
@@ -2,9 +2,9 @@ import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.utils.pip import Pip
|
||||
from cpl_cli.cli_settings import CLISettings
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
@@ -16,20 +16,20 @@ from cpl_cli.configuration.settings_helper import SettingsHelper
|
||||
class UpdateService(CommandABC):
|
||||
|
||||
def __init__(self,
|
||||
runtime: ApplicationRuntimeABC,
|
||||
env: ApplicationEnvironmentABC,
|
||||
build_settings: BuildSettings,
|
||||
project_settings: ProjectSettings,
|
||||
cli_settings: CLISettings):
|
||||
"""
|
||||
Service for the CLI command update
|
||||
:param runtime:
|
||||
:param env:
|
||||
:param build_settings:
|
||||
:param project_settings:
|
||||
:param cli_settings:
|
||||
"""
|
||||
CommandABC.__init__(self)
|
||||
|
||||
self._runtime = runtime
|
||||
self._env = env
|
||||
self._build_settings = build_settings
|
||||
self._project_settings = project_settings
|
||||
self._cli_settings = cli_settings
|
||||
@@ -117,7 +117,7 @@ class UpdateService(CommandABC):
|
||||
BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
|
||||
}
|
||||
|
||||
with open(os.path.join(self._runtime.working_directory, 'cpl.json'), 'w') as project:
|
||||
with open(os.path.join(self._env.working_directory, 'cpl.json'), 'w') as project:
|
||||
project.write(json.dumps(config, indent=2))
|
||||
project.close()
|
||||
|
||||
|
Reference in New Issue
Block a user