orionis 0.44.0__py3-none-any.whl → 0.47.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- orionis/cli_manager.py +16 -30
- orionis/contracts/bootstrap/i_command_bootstrapper.py +59 -0
- orionis/contracts/bootstrap/i_config_bootstrapper.py +112 -0
- orionis/contracts/bootstrap/i_environment_bootstrapper.py +33 -0
- orionis/{luminate/contracts/console/base/base_command_interface.py → contracts/console/base/i_command.py} +0 -1
- orionis/contracts/facades/config/i_config_facade.py +37 -0
- orionis/contracts/facades/environment/i_environment_facade.py +40 -0
- orionis/{luminate/contracts/facades/paths_interface.py → contracts/facades/files/i_path_facade.py} +27 -20
- orionis/contracts/facades/log/i_log_facade.py +83 -0
- orionis/{luminate/contracts/facades/tests_interface.py → contracts/facades/tests/i_tests_facade.py} +3 -6
- orionis/{luminate/contracts/console/scripts/management_interface.py → contracts/installer/i_installer_manager.py} +19 -16
- orionis/contracts/installer/i_installer_output.py +101 -0
- orionis/contracts/installer/i_installer_setup.py +59 -0
- orionis/contracts/providers/i_service_provider.py +27 -0
- orionis/contracts/services/config/i_config_service.py +37 -0
- orionis/contracts/services/files/i_path_service.py +31 -0
- orionis/contracts/services/log/i_log_service.py +89 -0
- orionis/{luminate/facades/environment.py → contracts/support/i_environment.py} +25 -32
- orionis/{luminate/contracts/tools/exception_to_dict_interface.py → contracts/support/i_exception_to_dict.py} +0 -9
- orionis/{luminate/contracts/tools/reflection_interface.py → contracts/support/i_reflection.py} +17 -8
- orionis/{luminate/contracts/tools/std_interface.py → contracts/support/i_std.py} +3 -16
- orionis/framework.py +1 -1
- orionis/{luminate/console/scripts/management.py → installer/installer_manager.py} +22 -16
- orionis/{luminate/installer/output.py → installer/installer_output.py} +16 -10
- orionis/{luminate/installer/setup.py → installer/installer_setup.py} +13 -25
- orionis/luminate/app.py +15 -11
- orionis/luminate/bootstrap/command_bootstrapper.py +150 -0
- orionis/luminate/bootstrap/config_bootstrapper.py +168 -0
- orionis/luminate/bootstrap/environment_bootstrapper.py +67 -0
- orionis/luminate/config/helpers.py +20 -0
- orionis/luminate/console/base/command.py +1 -3
- orionis/luminate/console/command_filter.py +2 -2
- orionis/luminate/console/commands/cache_clear.py +17 -5
- orionis/luminate/console/commands/help.py +19 -13
- orionis/luminate/console/commands/schedule_work.py +6 -3
- orionis/luminate/console/commands/tests.py +1 -6
- orionis/luminate/console/commands/version.py +0 -5
- orionis/luminate/console/exceptions/cli_exception.py +1 -4
- orionis/luminate/console/kernel.py +2 -2
- orionis/luminate/console/output/console.py +2 -2
- orionis/luminate/console/output/executor.py +1 -1
- orionis/luminate/console/output/progress_bar.py +1 -1
- orionis/luminate/console/parser.py +2 -2
- orionis/luminate/console/runner.py +127 -126
- orionis/luminate/console/tasks/scheduler.py +8 -7
- orionis/luminate/container/container.py +1 -1
- orionis/luminate/container/types.py +38 -12
- orionis/luminate/facades/config/config_facade.py +43 -0
- orionis/luminate/facades/environment/environment_facade.py +68 -0
- orionis/luminate/facades/{paths.py → files/path_facade.py} +50 -6
- orionis/luminate/facades/log/__init__.py +0 -0
- orionis/luminate/facades/log/log_facade.py +95 -0
- orionis/luminate/facades/tests/__init__.py +0 -0
- orionis/luminate/facades/{tests.py → tests/tests_facade.py} +1 -1
- orionis/luminate/patterns/__init__.py +0 -0
- orionis/luminate/pipelines/cli_pipeline.py +122 -116
- orionis/luminate/providers/__init__.py +0 -0
- orionis/luminate/providers/config/__init__.py +0 -0
- orionis/luminate/providers/config/config_service_provider.py +26 -0
- orionis/luminate/providers/files/__init__.py +0 -0
- orionis/luminate/providers/files/path_service_provider.py +26 -0
- orionis/luminate/providers/log/__init__.py +0 -0
- orionis/luminate/providers/log/log_service_provider.py +26 -0
- orionis/luminate/services/__init__.py +0 -0
- orionis/luminate/services/config/__init__.py +0 -0
- orionis/luminate/services/config/config_service.py +72 -0
- orionis/luminate/services/files/__init__.py +0 -0
- orionis/luminate/services/files/path_service.py +71 -0
- orionis/luminate/services/log/__init__.py +0 -0
- orionis/luminate/services/log/log_service.py +159 -0
- orionis/luminate/{config → support}/environment.py +21 -32
- orionis/luminate/{tools → support}/exception_to_dict.py +1 -1
- orionis/luminate/{tools → support}/reflection.py +1 -1
- orionis/luminate/{tools → support}/std.py +1 -1
- orionis/luminate/test/unit_test.py +1 -2
- {orionis-0.44.0.dist-info → orionis-0.47.0.dist-info}/METADATA +1 -1
- orionis-0.47.0.dist-info/RECORD +157 -0
- tests/tools/test_reflection.py +1 -1
- orionis/luminate/bootstrap/commands/bootstrapper.py +0 -101
- orionis/luminate/bootstrap/commands/register.py +0 -92
- orionis/luminate/bootstrap/config/bootstrapper.py +0 -79
- orionis/luminate/bootstrap/config/parser.py +0 -53
- orionis/luminate/bootstrap/config/register.py +0 -76
- orionis/luminate/cache/app/config.py +0 -91
- orionis/luminate/cache/console/commands.py +0 -97
- orionis/luminate/console/cache.py +0 -87
- orionis/luminate/console/command.py +0 -40
- orionis/luminate/contracts/bootstrap/commands/bootstrapper_interface.py +0 -44
- orionis/luminate/contracts/bootstrap/commands/register_interface.py +0 -33
- orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py +0 -40
- orionis/luminate/contracts/bootstrap/config/parser_interface.py +0 -46
- orionis/luminate/contracts/bootstrap/config/register_interface.py +0 -47
- orionis/luminate/contracts/cache/app/config_interface.py +0 -76
- orionis/luminate/contracts/cache/console/commands_interface.py +0 -78
- orionis/luminate/contracts/config/environment_interface.py +0 -64
- orionis/luminate/contracts/console/command_interface.py +0 -36
- orionis/luminate/contracts/console/runner_interface.py +0 -50
- orionis/luminate/contracts/facades/env_interface.py +0 -64
- orionis/luminate/contracts/facades/log_interface.py +0 -48
- orionis/luminate/contracts/files/paths_interface.py +0 -29
- orionis/luminate/contracts/installer/output_interface.py +0 -125
- orionis/luminate/contracts/installer/setup_interface.py +0 -29
- orionis/luminate/contracts/installer/upgrade_interface.py +0 -24
- orionis/luminate/contracts/log/logger_interface.py +0 -33
- orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +0 -84
- orionis/luminate/contracts/publisher/pypi_publisher_interface.py +0 -36
- orionis/luminate/contracts/test/unit_test_interface.py +0 -51
- orionis/luminate/facades/config.py +0 -10
- orionis/luminate/facades/log.py +0 -56
- orionis/luminate/files/paths.py +0 -56
- orionis/luminate/installer/upgrade.py +0 -42
- orionis/luminate/log/logger.py +0 -116
- orionis/luminate/publisher/pypi.py +0 -215
- orionis-0.44.0.dist-info/RECORD +0 -156
- /orionis/{luminate/bootstrap/config → contracts}/__init__.py +0 -0
- /orionis/{luminate/cache → contracts/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/config/config_interface.py → contracts/config/i_config.py} +0 -0
- /orionis/{luminate/cache/app → contracts/console}/__init__.py +0 -0
- /orionis/{luminate/cache/console → contracts/console/base}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/command_filter_interface.py → contracts/console/i_command_filter.py} +0 -0
- /orionis/{luminate/contracts/console/kernel_interface.py → contracts/console/i_kernel.py} +0 -0
- /orionis/{luminate/contracts/console/parser_interface.py → contracts/console/i_parser.py} +0 -0
- /orionis/{luminate/contracts/console/task_manager_interface.py → contracts/console/i_task_manager.py} +0 -0
- /orionis/{luminate/config/dataclass → contracts/console/output}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/output/console_interface.py → contracts/console/output/i_console.py} +0 -0
- /orionis/{luminate/contracts/console/output/executor_interface.py → contracts/console/output/i_executor.py} +0 -0
- /orionis/{luminate/contracts/console/output/progress_bar_interface.py → contracts/console/output/i_progress_bar.py} +0 -0
- /orionis/{luminate/console/scripts → contracts/console/tasks}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/tasks/schedule_interface.py → contracts/console/tasks/i_schedule.py} +0 -0
- /orionis/{luminate/contracts/container/container_interface.py → contracts/container/i_container.py} +0 -0
- /orionis/{luminate/contracts/container/types_interface.py → contracts/container/i_types.py} +0 -0
- /orionis/{luminate/contracts → contracts/facades}/__init__.py +0 -0
- /orionis/{luminate/contracts/cache → contracts/facades/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/config → contracts/facades/environment}/__init__.py +0 -0
- /orionis/{luminate/contracts/console → contracts/facades/files}/__init__.py +0 -0
- /orionis/{luminate/contracts/facades → contracts/facades/log}/__init__.py +0 -0
- /orionis/{luminate/contracts/files → contracts/facades/tests}/__init__.py +0 -0
- /orionis/{luminate/contracts → contracts}/installer/__init__.py +0 -0
- /orionis/{luminate/contracts/log → contracts/providers}/__init__.py +0 -0
- /orionis/{luminate/contracts/publisher → contracts/services}/__init__.py +0 -0
- /orionis/{luminate/contracts/test → contracts/services/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/tools → contracts/services/files}/__init__.py +0 -0
- /orionis/{luminate/files → contracts/services/log}/__init__.py +0 -0
- /orionis/{luminate/installer → installer}/__init__.py +0 -0
- /orionis/luminate/bootstrap/{cli_exception.py → exception_bootstrapper.py} +0 -0
- /orionis/luminate/config/{dataclass/app.py → app.py} +0 -0
- /orionis/luminate/config/{dataclass/auth.py → auth.py} +0 -0
- /orionis/luminate/config/{dataclass/cache.py → cache.py} +0 -0
- /orionis/luminate/config/{dataclass/cors.py → cors.py} +0 -0
- /orionis/luminate/config/{dataclass/database.py → database.py} +0 -0
- /orionis/luminate/config/{dataclass/filesystems.py → filesystems.py} +0 -0
- /orionis/luminate/config/{dataclass/logging.py → logging.py} +0 -0
- /orionis/luminate/config/{dataclass/mail.py → mail.py} +0 -0
- /orionis/luminate/config/{dataclass/queue.py → queue.py} +0 -0
- /orionis/luminate/config/{dataclass/session.py → session.py} +0 -0
- /orionis/luminate/{log → facades/config}/__init__.py +0 -0
- /orionis/luminate/{publisher → facades/environment}/__init__.py +0 -0
- /orionis/luminate/{tools → facades/files}/__init__.py +0 -0
- /orionis/luminate/{tools → support}/dot_dict.py +0 -0
- /orionis/{luminate/installer → static/ascii}/icon.ascii +0 -0
- /orionis/{luminate/installer → static/ascii}/info.ascii +0 -0
- /orionis/{luminate/static → static}/bg/galaxy.jpg +0 -0
- /orionis/{luminate/static → static}/favicon/OrionisFrameworkFavicon.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.jpg +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.psd +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework2.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework3.png +0 -0
- {orionis-0.44.0.dist-info → orionis-0.47.0.dist-info}/LICENCE +0 -0
- {orionis-0.44.0.dist-info → orionis-0.47.0.dist-info}/WHEEL +0 -0
- {orionis-0.44.0.dist-info → orionis-0.47.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.44.0.dist-info → orionis-0.47.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
from orionis.contracts.facades.environment.i_environment_facade import IEnv
|
2
|
+
from orionis.luminate.app_context import AppContext
|
3
|
+
|
4
|
+
def env(key: str, default=None) -> str:
|
5
|
+
"""
|
6
|
+
Retrieves the value of an environment variable.
|
7
|
+
|
8
|
+
This function provides a convenient way to access environment variables
|
9
|
+
stored in the application context. If the variable does not exist, it
|
10
|
+
returns the specified default value.
|
11
|
+
|
12
|
+
Parameters
|
13
|
+
----------
|
14
|
+
key : str
|
15
|
+
The name of the environment variable to retrieve.
|
16
|
+
default : Any, optional
|
17
|
+
The default value to return if the environment variable does not exist.
|
18
|
+
Defaults to None.
|
19
|
+
|
20
|
+
Returns
|
21
|
+
-------
|
22
|
+
str
|
23
|
+
The value of the environment variable, or the default value if the variable
|
24
|
+
does not exist.
|
25
|
+
"""
|
26
|
+
with AppContext() as app:
|
27
|
+
env : dict = app._environment_vars
|
28
|
+
return env.get(key, default)
|
29
|
+
|
30
|
+
class Env(IEnv):
|
31
|
+
"""
|
32
|
+
A facade class for accessing environment variables.
|
33
|
+
|
34
|
+
This class provides a static method to retrieve environment variables
|
35
|
+
stored in the application context. It implements the `IEnv` interface.
|
36
|
+
|
37
|
+
Methods
|
38
|
+
-------
|
39
|
+
get(key: str, default=None) -> str
|
40
|
+
Retrieves the value of an environment variable.
|
41
|
+
"""
|
42
|
+
|
43
|
+
@staticmethod
|
44
|
+
def get(key: str, default=None) -> str:
|
45
|
+
"""
|
46
|
+
Retrieves the value of an environment variable.
|
47
|
+
|
48
|
+
This method provides a convenient way to access environment variables
|
49
|
+
stored in the application context. If the variable does not exist, it
|
50
|
+
returns the specified default value.
|
51
|
+
|
52
|
+
Parameters
|
53
|
+
----------
|
54
|
+
key : str
|
55
|
+
The name of the environment variable to retrieve.
|
56
|
+
default : Any, optional
|
57
|
+
The default value to return if the environment variable does not exist.
|
58
|
+
Defaults to None.
|
59
|
+
|
60
|
+
Returns
|
61
|
+
-------
|
62
|
+
str
|
63
|
+
The value of the environment variable, or the default value if the variable
|
64
|
+
does not exist.
|
65
|
+
"""
|
66
|
+
with AppContext() as app:
|
67
|
+
env : dict = app._environment_vars
|
68
|
+
return env.get(key, default)
|
@@ -1,25 +1,60 @@
|
|
1
1
|
import os
|
2
|
-
from orionis.
|
3
|
-
from orionis.luminate.
|
2
|
+
from orionis.contracts.facades.files.i_path_facade import IPath
|
3
|
+
from orionis.luminate.app_context import AppContext
|
4
|
+
from orionis.luminate.services.files.path_service import PathService
|
4
5
|
|
5
6
|
class Path(IPath):
|
7
|
+
"""
|
8
|
+
A facade class for resolving absolute paths to various application directories.
|
9
|
+
|
10
|
+
This class provides static methods to resolve paths to common directories such as
|
11
|
+
'app', 'config', 'database', 'resources', 'routes', 'storage', and 'tests'.
|
12
|
+
It uses the `PathService` to resolve and validate paths.
|
13
|
+
|
14
|
+
Methods
|
15
|
+
-------
|
16
|
+
_resolve_directory(directory: str, file: str = None) -> SkeletonPath
|
17
|
+
Resolves the absolute path for a given directory and optional file.
|
18
|
+
app(file: str = None) -> SkeletonPath
|
19
|
+
Returns the absolute path for a file inside the 'app' directory.
|
20
|
+
config(file: str = None) -> SkeletonPath
|
21
|
+
Returns the absolute path for a file inside the 'config' directory.
|
22
|
+
database(file: str = None) -> SkeletonPath
|
23
|
+
Returns the absolute path for a file inside the 'database' directory.
|
24
|
+
resource(file: str = None) -> SkeletonPath
|
25
|
+
Returns the absolute path for a file inside the 'resource' directory.
|
26
|
+
routes(file: str = None) -> SkeletonPath
|
27
|
+
Returns the absolute path for a file inside the 'routes' directory.
|
28
|
+
storage(file: str = None) -> SkeletonPath
|
29
|
+
Returns the absolute path for a file inside the 'storage' directory.
|
30
|
+
tests(file: str = None) -> SkeletonPath
|
31
|
+
Returns the absolute path for a file inside the 'tests' directory.
|
32
|
+
"""
|
6
33
|
|
7
34
|
@staticmethod
|
8
35
|
def _resolve_directory(directory: str, file: str = None):
|
9
36
|
"""
|
10
|
-
|
37
|
+
Resolves the absolute path for a given directory and optional file.
|
38
|
+
|
39
|
+
This method constructs a path by joining the directory and file, normalizes it,
|
40
|
+
and resolves it using the `PathService`.
|
11
41
|
|
12
42
|
Parameters
|
13
43
|
----------
|
14
44
|
directory : str
|
15
45
|
The base directory to resolve the path from.
|
16
46
|
file : str, optional
|
17
|
-
The relative file path inside the directory (default is
|
47
|
+
The relative file path inside the directory (default is None).
|
18
48
|
|
19
49
|
Returns
|
20
50
|
-------
|
21
51
|
SkeletonPath
|
22
52
|
The resolved absolute path wrapped in a SkeletonPath object.
|
53
|
+
|
54
|
+
Raises
|
55
|
+
------
|
56
|
+
ValueError
|
57
|
+
If the resolved path is invalid or cannot be resolved.
|
23
58
|
"""
|
24
59
|
# Default to an empty string if None
|
25
60
|
file = file or ""
|
@@ -30,7 +65,10 @@ class Path(IPath):
|
|
30
65
|
# Normalize path (removes redundant slashes)
|
31
66
|
route = os.path.normpath(route)
|
32
67
|
|
33
|
-
|
68
|
+
# Obtain the path service from the container
|
69
|
+
with AppContext() as app:
|
70
|
+
path_service : PathService = app.container.make(PathService)
|
71
|
+
return path_service.resolve(route)
|
34
72
|
|
35
73
|
@staticmethod
|
36
74
|
def app(file: str = None):
|
@@ -171,6 +209,7 @@ def app_path(file: str = None):
|
|
171
209
|
"""
|
172
210
|
return Path._resolve_directory("app", file)
|
173
211
|
|
212
|
+
|
174
213
|
def config_path(file: str = None):
|
175
214
|
"""
|
176
215
|
Returns the absolute path for a file inside the 'config' directory.
|
@@ -187,6 +226,7 @@ def config_path(file: str = None):
|
|
187
226
|
"""
|
188
227
|
return Path._resolve_directory("config", file)
|
189
228
|
|
229
|
+
|
190
230
|
def database_path(file: str = None):
|
191
231
|
"""
|
192
232
|
Returns the absolute path for a file inside the 'database' directory.
|
@@ -203,6 +243,7 @@ def database_path(file: str = None):
|
|
203
243
|
"""
|
204
244
|
return Path._resolve_directory("database", file)
|
205
245
|
|
246
|
+
|
206
247
|
def resource_path(file: str = None):
|
207
248
|
"""
|
208
249
|
Returns the absolute path for a file inside the 'resource' directory.
|
@@ -219,6 +260,7 @@ def resource_path(file: str = None):
|
|
219
260
|
"""
|
220
261
|
return Path._resolve_directory("resource", file)
|
221
262
|
|
263
|
+
|
222
264
|
def routes_path(file: str = None):
|
223
265
|
"""
|
224
266
|
Returns the absolute path for a file inside the 'routes' directory.
|
@@ -235,6 +277,7 @@ def routes_path(file: str = None):
|
|
235
277
|
"""
|
236
278
|
return Path._resolve_directory("routes", file)
|
237
279
|
|
280
|
+
|
238
281
|
def storage_path(file: str = None):
|
239
282
|
"""
|
240
283
|
Returns the absolute path for a file inside the 'storage' directory.
|
@@ -251,6 +294,7 @@ def storage_path(file: str = None):
|
|
251
294
|
"""
|
252
295
|
return Path._resolve_directory("storage", file)
|
253
296
|
|
297
|
+
|
254
298
|
def tests_path(file: str = None):
|
255
299
|
"""
|
256
300
|
Returns the absolute path for a file inside the 'tests' directory.
|
@@ -265,4 +309,4 @@ def tests_path(file: str = None):
|
|
265
309
|
SkeletonPath
|
266
310
|
The resolved path wrapped in a SkeletonPath object.
|
267
311
|
"""
|
268
|
-
return Path._resolve_directory("tests", file)
|
312
|
+
return Path._resolve_directory("tests", file)
|
File without changes
|
@@ -0,0 +1,95 @@
|
|
1
|
+
from orionis.contracts.facades.log.i_log_facade import ILog
|
2
|
+
from orionis.luminate.app_context import AppContext
|
3
|
+
from orionis.luminate.services.log.log_service import LogguerService
|
4
|
+
|
5
|
+
class Log(ILog):
|
6
|
+
"""
|
7
|
+
A facade class for logging messages with different severity levels.
|
8
|
+
|
9
|
+
This class provides static methods to log messages using the `LogguerService`.
|
10
|
+
It simplifies the process of logging by abstracting the service resolution
|
11
|
+
and providing a clean interface for logging.
|
12
|
+
|
13
|
+
Methods
|
14
|
+
-------
|
15
|
+
info(message: str) -> None
|
16
|
+
Logs an informational message.
|
17
|
+
error(message: str) -> None
|
18
|
+
Logs an error message.
|
19
|
+
success(message: str) -> None
|
20
|
+
Logs a success message.
|
21
|
+
warning(message: str) -> None
|
22
|
+
Logs a warning message.
|
23
|
+
debug(message: str) -> None
|
24
|
+
Logs a debug message.
|
25
|
+
"""
|
26
|
+
|
27
|
+
@staticmethod
|
28
|
+
def info(message: str) -> None:
|
29
|
+
"""
|
30
|
+
Logs an informational message.
|
31
|
+
|
32
|
+
Parameters
|
33
|
+
----------
|
34
|
+
message : str
|
35
|
+
The message to log.
|
36
|
+
"""
|
37
|
+
with AppContext() as app:
|
38
|
+
log_service: LogguerService = app.container.make(LogguerService)
|
39
|
+
log_service.info(message)
|
40
|
+
|
41
|
+
@staticmethod
|
42
|
+
def error(message: str) -> None:
|
43
|
+
"""
|
44
|
+
Logs an error message.
|
45
|
+
|
46
|
+
Parameters
|
47
|
+
----------
|
48
|
+
message : str
|
49
|
+
The message to log.
|
50
|
+
"""
|
51
|
+
with AppContext() as app:
|
52
|
+
log_service: LogguerService = app.container.make(LogguerService)
|
53
|
+
log_service.error(message)
|
54
|
+
|
55
|
+
@staticmethod
|
56
|
+
def success(message: str) -> None:
|
57
|
+
"""
|
58
|
+
Logs a success message.
|
59
|
+
|
60
|
+
Parameters
|
61
|
+
----------
|
62
|
+
message : str
|
63
|
+
The message to log.
|
64
|
+
"""
|
65
|
+
with AppContext() as app:
|
66
|
+
log_service: LogguerService = app.container.make(LogguerService)
|
67
|
+
log_service.success(message)
|
68
|
+
|
69
|
+
@staticmethod
|
70
|
+
def warning(message: str) -> None:
|
71
|
+
"""
|
72
|
+
Logs a warning message.
|
73
|
+
|
74
|
+
Parameters
|
75
|
+
----------
|
76
|
+
message : str
|
77
|
+
The message to log.
|
78
|
+
"""
|
79
|
+
with AppContext() as app:
|
80
|
+
log_service: LogguerService = app.container.make(LogguerService)
|
81
|
+
log_service.warning(message)
|
82
|
+
|
83
|
+
@staticmethod
|
84
|
+
def debug(message: str) -> None:
|
85
|
+
"""
|
86
|
+
Logs a debug message.
|
87
|
+
|
88
|
+
Parameters
|
89
|
+
----------
|
90
|
+
message : str
|
91
|
+
The message to log.
|
92
|
+
"""
|
93
|
+
with AppContext() as app:
|
94
|
+
log_service: LogguerService = app.container.make(LogguerService)
|
95
|
+
log_service.debug(message)
|
File without changes
|
File without changes
|
@@ -1,116 +1,122 @@
|
|
1
|
-
import argparse
|
2
|
-
from typing import Dict, Any, Optional
|
3
|
-
from orionis.luminate.
|
4
|
-
from orionis.luminate.console.
|
5
|
-
from orionis.luminate.console.
|
6
|
-
from orionis.luminate.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
1
|
+
# import argparse
|
2
|
+
# from typing import Dict, Any, Optional
|
3
|
+
# from orionis.luminate.app_context import AppContext
|
4
|
+
# from orionis.luminate.console.parser import Parser
|
5
|
+
# from orionis.luminate.console.cache import CLICache
|
6
|
+
# from orionis.luminate.console.base.command import BaseCommand
|
7
|
+
# from orionis.luminate.contracts.pipelines.cli_pipeline_interface import ICLIPipeline
|
8
|
+
|
9
|
+
class CLIPipeline:
|
10
|
+
pass
|
11
|
+
# """
|
12
|
+
# Handles the retrieval, parsing, and execution of CLI commands within the Orionis framework.
|
13
|
+
|
14
|
+
# This class is responsible for:
|
15
|
+
# - Retrieving command metadata from cache.
|
16
|
+
# - Parsing command-line arguments dynamically.
|
17
|
+
# - Executing the corresponding command with parsed arguments.
|
18
|
+
|
19
|
+
# Attributes
|
20
|
+
# ----------
|
21
|
+
# _command : dict
|
22
|
+
# Stores the command's metadata, including its instance and expected arguments.
|
23
|
+
# _parsed_arguments : argparse.Namespace
|
24
|
+
# Holds parsed arguments after processing user input.
|
25
|
+
# """
|
26
|
+
|
27
|
+
# def __init__(self):
|
28
|
+
# """
|
29
|
+
# Initializes the CLIPipeline instance with an empty command cache
|
30
|
+
# and a default argument namespace.
|
31
|
+
# """
|
32
|
+
# self._command: Dict[str, Any] = {}
|
33
|
+
# self._parsed_arguments: argparse.Namespace = argparse.Namespace()
|
34
|
+
|
35
|
+
# def getCommand(self, signature: str) -> "CLIPipeline":
|
36
|
+
# """
|
37
|
+
# Retrieves a command from the cache based on its signature.
|
38
|
+
|
39
|
+
# Parameters
|
40
|
+
# ----------
|
41
|
+
# signature : str
|
42
|
+
# The unique identifier of the command.
|
43
|
+
|
44
|
+
# Returns
|
45
|
+
# -------
|
46
|
+
# CLIPipeline
|
47
|
+
# The current instance of CLIPipeline for method chaining.
|
48
|
+
|
49
|
+
# Raises
|
50
|
+
# ------
|
51
|
+
# ValueError
|
52
|
+
# If the command signature is not found in the cache.
|
53
|
+
# """
|
54
|
+
# with AppContext() as app:
|
55
|
+
# config_service : BaseCommand = app.container.run_command("config")
|
56
|
+
# config_service.
|
57
|
+
|
58
|
+
# try:
|
59
|
+
# cache = CLICache().getCommands()
|
60
|
+
# self._command = cache.get(signature)
|
61
|
+
# return self
|
62
|
+
# except KeyError as e:
|
63
|
+
# raise ValueError(e)
|
64
|
+
|
65
|
+
# def parseArguments(self, vars: Optional[Dict[str, Any]] = None, *args, **kwargs) -> "CLIPipeline":
|
66
|
+
# """
|
67
|
+
# Parses command-line arguments using the Orionis argument parser.
|
68
|
+
|
69
|
+
# Parameters
|
70
|
+
# ----------
|
71
|
+
# vars : dict, optional
|
72
|
+
# A dictionary of predefined variables to be included in parsing.
|
73
|
+
# *args
|
74
|
+
# Positional arguments for the parser.
|
75
|
+
# **kwargs
|
76
|
+
# Keyword arguments for the parser.
|
77
|
+
|
78
|
+
# Returns
|
79
|
+
# -------
|
80
|
+
# CLIPipeline
|
81
|
+
# The current instance of CLIPipeline for method chaining.
|
82
|
+
|
83
|
+
# Raises
|
84
|
+
# ------
|
85
|
+
# ValueError
|
86
|
+
# If an error occurs during argument parsing.
|
87
|
+
# """
|
88
|
+
# try:
|
89
|
+
# arguments = self._command.get("arguments")
|
90
|
+
# if arguments:
|
91
|
+
# arg_parser = Parser(vars=vars or {}, args=args, kwargs=kwargs)
|
92
|
+
# arg_parser.setArguments(arguments=arguments)
|
93
|
+
# arg_parser.recognize()
|
94
|
+
# self._parsed_arguments = arg_parser.get()
|
95
|
+
|
96
|
+
# return self
|
97
|
+
|
98
|
+
# except Exception as e:
|
99
|
+
# raise ValueError(f"Error parsing arguments: {e}")
|
100
|
+
|
101
|
+
# def execute(self) -> Any:
|
102
|
+
# """
|
103
|
+
# Executes the retrieved command using parsed arguments.
|
104
|
+
|
105
|
+
# This method:
|
106
|
+
# - Instantiates the command class.
|
107
|
+
# - Calls the `handle()` method, passing the parsed arguments.
|
108
|
+
|
109
|
+
# Returns
|
110
|
+
# -------
|
111
|
+
# Any
|
112
|
+
# The output of the command execution.
|
113
|
+
|
114
|
+
# Raises
|
115
|
+
# ------
|
116
|
+
# ValueError
|
117
|
+
# If the command instance is invalid.
|
118
|
+
# """
|
119
|
+
# command_class = self._command.get("instance")
|
120
|
+
# command_instance: BaseCommand = command_class()
|
121
|
+
# command_instance.setArgs(self._parsed_arguments)
|
122
|
+
# return command_instance.handle(**vars(self._parsed_arguments))
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from orionis.contracts.providers.i_service_provider import IServiceProvider
|
2
|
+
from orionis.luminate.container.container import Container
|
3
|
+
from orionis.luminate.services.config.config_service import ConfigService
|
4
|
+
|
5
|
+
class ConfigServiceProvider(IServiceProvider):
|
6
|
+
|
7
|
+
def register(self, container: Container) -> None:
|
8
|
+
"""
|
9
|
+
Registers services or bindings into the given container.
|
10
|
+
|
11
|
+
Args:
|
12
|
+
container (Container): The container to register services or bindings into.
|
13
|
+
"""
|
14
|
+
self.key_sp = container.scoped(ConfigService)
|
15
|
+
|
16
|
+
def boot(self, container: Container) -> None:
|
17
|
+
"""
|
18
|
+
Boot the service provider.
|
19
|
+
|
20
|
+
This method is intended to be overridden by subclasses to perform
|
21
|
+
any necessary bootstrapping or initialization tasks.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
container (Container): The service container instance.
|
25
|
+
"""
|
26
|
+
container.make(self.key_sp)
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from orionis.contracts.providers.i_service_provider import IServiceProvider
|
2
|
+
from orionis.luminate.container.container import Container
|
3
|
+
from orionis.luminate.services.files.path_service import PathService
|
4
|
+
|
5
|
+
class PathServiceProvider(IServiceProvider):
|
6
|
+
|
7
|
+
def register(self, container: Container) -> None:
|
8
|
+
"""
|
9
|
+
Registers services or bindings into the given container.
|
10
|
+
|
11
|
+
Args:
|
12
|
+
container (Container): The container to register services or bindings into.
|
13
|
+
"""
|
14
|
+
self.key_sp = container.singleton(PathService)
|
15
|
+
|
16
|
+
def boot(self, container: Container) -> None:
|
17
|
+
"""
|
18
|
+
Boot the service provider.
|
19
|
+
|
20
|
+
This method is intended to be overridden by subclasses to perform
|
21
|
+
any necessary bootstrapping or initialization tasks.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
container (Container): The service container instance.
|
25
|
+
"""
|
26
|
+
container.make(self.key_sp)
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from orionis.contracts.providers.i_service_provider import IServiceProvider
|
2
|
+
from orionis.luminate.container.container import Container
|
3
|
+
from orionis.luminate.services.log.log_service import LogguerService
|
4
|
+
|
5
|
+
class LogServiceProvider(IServiceProvider):
|
6
|
+
|
7
|
+
def register(self, container: Container) -> None:
|
8
|
+
"""
|
9
|
+
Registers services or bindings into the given container.
|
10
|
+
|
11
|
+
Args:
|
12
|
+
container (Container): The container to register services or bindings into.
|
13
|
+
"""
|
14
|
+
self.key_sp = container.singleton(LogguerService)
|
15
|
+
|
16
|
+
def boot(self, container: Container) -> None:
|
17
|
+
"""
|
18
|
+
Boot the service provider.
|
19
|
+
|
20
|
+
This method is intended to be overridden by subclasses to perform
|
21
|
+
any necessary bootstrapping or initialization tasks.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
container (Container): The service container instance.
|
25
|
+
"""
|
26
|
+
container.make(self.key_sp)
|
File without changes
|
File without changes
|