orionis 0.179.0__py3-none-any.whl → 0.183.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/{cli_manager.py → console.py} +3 -3
- orionis/framework.py +1 -1
- orionis/installer/contracts/output.py +39 -0
- orionis/installer/contracts/setup.py +28 -0
- orionis/installer/manager.py +8 -18
- orionis/installer/output.py +256 -0
- orionis/installer/{setup/setup.py → setup.py} +29 -16
- orionis/luminate/application.py +3 -9
- orionis/luminate/console/command_filter.py +6 -9
- orionis/luminate/console/commands/help.py +4 -8
- orionis/luminate/console/commands/schedule_work.py +1 -1
- orionis/luminate/container/resolve.py +2 -9
- orionis/luminate/services/commands/reactor_commands_service.py +1 -2
- orionis/luminate/services/config/config_service.py +1 -2
- orionis/luminate/support/asyn_run.py +21 -0
- orionis/static/ascii/icon.ascii +1 -0
- orionis/static/ascii/info.ascii +1 -0
- {orionis-0.179.0.dist-info → orionis-0.183.0.dist-info}/METADATA +1 -1
- {orionis-0.179.0.dist-info → orionis-0.183.0.dist-info}/RECORD +24 -26
- orionis-0.183.0.dist-info/entry_points.txt +2 -0
- orionis/installer/contracts/installer_output.py +0 -101
- orionis/installer/contracts/installer_setup.py +0 -59
- orionis/installer/output/__init__.py +0 -0
- orionis/installer/output/output.py +0 -218
- orionis/installer/setup/__init__.py +0 -0
- orionis/installer/version.py +0 -27
- orionis-0.179.0.dist-info/entry_points.txt +0 -2
- /orionis/installer/contracts/{installer_manager.py → manager.py} +0 -0
- {orionis-0.179.0.dist-info → orionis-0.183.0.dist-info}/LICENCE +0 -0
- {orionis-0.179.0.dist-info → orionis-0.183.0.dist-info}/WHEEL +0 -0
- {orionis-0.179.0.dist-info → orionis-0.183.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
import argparse
|
2
2
|
from orionis.installer.manager import InstallerManager
|
3
|
-
from orionis.
|
3
|
+
from orionis.luminate.console.output.console import Console
|
4
4
|
|
5
|
-
# Main entry point for the Orionis CLI
|
5
|
+
# Main entry point for the Orionis CLI Installer.
|
6
6
|
def main():
|
7
7
|
|
8
8
|
# Initialize the argument parser
|
@@ -27,7 +27,7 @@ def main():
|
|
27
27
|
else:
|
28
28
|
installer.handleInfo()
|
29
29
|
except Exception as e:
|
30
|
-
|
30
|
+
Console.exception(e)
|
31
31
|
|
32
32
|
# Execute the main function if the script is run directly
|
33
33
|
if __name__ == "__main__":
|
orionis/framework.py
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IInstallerOutput(ABC):
|
4
|
+
|
5
|
+
@abstractmethod
|
6
|
+
def printHelp(self):
|
7
|
+
"""
|
8
|
+
Prints the help message with available commands.
|
9
|
+
|
10
|
+
If the ASCII file is not found, it falls back to a basic message.
|
11
|
+
"""
|
12
|
+
pass
|
13
|
+
|
14
|
+
@abstractmethod
|
15
|
+
def printIcon(self):
|
16
|
+
"""
|
17
|
+
Prints the Orionis icon with a motivational message.
|
18
|
+
|
19
|
+
If the ASCII file is not found, it falls back to a basic message.
|
20
|
+
"""
|
21
|
+
pass
|
22
|
+
|
23
|
+
@abstractmethod
|
24
|
+
def printStartInstallation(self):
|
25
|
+
"""
|
26
|
+
Prints the start of the installation message.
|
27
|
+
|
28
|
+
Displays the Orionis icon and a thank you message.
|
29
|
+
"""
|
30
|
+
pass
|
31
|
+
|
32
|
+
@abstractmethod
|
33
|
+
def printEndInstallation(self):
|
34
|
+
"""
|
35
|
+
Prints the end of the installation message.
|
36
|
+
|
37
|
+
Displays a welcome message and encourages the user to start using the framework.
|
38
|
+
"""
|
39
|
+
pass
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IInstallerSetup(ABC):
|
4
|
+
"""
|
5
|
+
Interface for the InstallerSetup class.
|
6
|
+
"""
|
7
|
+
|
8
|
+
@abstractmethod
|
9
|
+
def handle(self):
|
10
|
+
"""
|
11
|
+
Executes the setup process for initializing the Orionis project.
|
12
|
+
|
13
|
+
This process includes:
|
14
|
+
1. Cloning the repository.
|
15
|
+
2. Creating a virtual environment.
|
16
|
+
3. Installing dependencies from requirements.txt.
|
17
|
+
4. Setting up the .env file.
|
18
|
+
5. Generating an API key.
|
19
|
+
6. Cleaning up temporary files and .git remote origin.
|
20
|
+
|
21
|
+
Raises
|
22
|
+
------
|
23
|
+
ValueError
|
24
|
+
If there is an error during any subprocess execution.
|
25
|
+
Exception
|
26
|
+
If any unexpected error occurs.
|
27
|
+
"""
|
28
|
+
pass
|
orionis/installer/manager.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
import subprocess
|
3
2
|
import sys
|
4
|
-
from orionis.installer.contracts.
|
5
|
-
from orionis.installer.
|
6
|
-
from orionis.installer.
|
3
|
+
from orionis.installer.contracts.manager import IInstallerManager
|
4
|
+
from orionis.installer.output import InstallerOutput
|
5
|
+
from orionis.installer.setup import InstallerSetup
|
7
6
|
|
8
7
|
class InstallerManager(IInstallerManager):
|
9
8
|
"""
|
@@ -18,7 +17,7 @@ class InstallerManager(IInstallerManager):
|
|
18
17
|
Instance of Output to manage command-line display messages.
|
19
18
|
"""
|
20
19
|
|
21
|
-
def __init__(self
|
20
|
+
def __init__(self):
|
22
21
|
"""
|
23
22
|
Initialize the Management class with an output handler.
|
24
23
|
|
@@ -27,7 +26,7 @@ class InstallerManager(IInstallerManager):
|
|
27
26
|
output : Output
|
28
27
|
An instance of Output to handle command-line messages.
|
29
28
|
"""
|
30
|
-
self.
|
29
|
+
self._output = InstallerOutput()
|
31
30
|
|
32
31
|
def handleVersion(self) -> str:
|
33
32
|
"""
|
@@ -37,16 +36,8 @@ class InstallerManager(IInstallerManager):
|
|
37
36
|
-------
|
38
37
|
str
|
39
38
|
The ASCII representation of the framework version.
|
40
|
-
|
41
|
-
Raises
|
42
|
-
------
|
43
|
-
Exception
|
44
|
-
If an error occurs while generating the ASCII version output.
|
45
39
|
"""
|
46
|
-
|
47
|
-
return self.output.asciiIco()
|
48
|
-
except Exception as e:
|
49
|
-
raise RuntimeError(f"Failed to display version: {e}")
|
40
|
+
return self._output.printIcon()
|
50
41
|
|
51
42
|
def handleUpgrade(self) -> None:
|
52
43
|
"""
|
@@ -58,7 +49,6 @@ class InstallerManager(IInstallerManager):
|
|
58
49
|
If an error occurs during the upgrade process.
|
59
50
|
"""
|
60
51
|
try:
|
61
|
-
self.output.info("Starting the upgrade process...")
|
62
52
|
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "orionis"])
|
63
53
|
except subprocess.CalledProcessError as e:
|
64
54
|
raise RuntimeError(f"Upgrade failed: {e}")
|
@@ -81,7 +71,7 @@ class InstallerManager(IInstallerManager):
|
|
81
71
|
If an error occurs during the application setup.
|
82
72
|
"""
|
83
73
|
try:
|
84
|
-
InstallerSetup(name=name_app, output=self.
|
74
|
+
return InstallerSetup(name=name_app, output=self._output).handle()
|
85
75
|
except Exception as e:
|
86
76
|
raise RuntimeError(f"Failed to create new app: {e}")
|
87
77
|
|
@@ -95,6 +85,6 @@ class InstallerManager(IInstallerManager):
|
|
95
85
|
If an error occurs while displaying information.
|
96
86
|
"""
|
97
87
|
try:
|
98
|
-
self.
|
88
|
+
self._output.asciiInfo()
|
99
89
|
except Exception as e:
|
100
90
|
raise RuntimeError(f"Failed to display information: {e}")
|
@@ -0,0 +1,256 @@
|
|
1
|
+
import os
|
2
|
+
import datetime
|
3
|
+
import requests
|
4
|
+
from orionis.framework import API, NAME, VERSION, DOCS
|
5
|
+
from orionis.installer.contracts.output import IInstallerOutput
|
6
|
+
|
7
|
+
class InstallerOutput(IInstallerOutput):
|
8
|
+
"""
|
9
|
+
A class to handle the output and display messages for the Orionis installer.
|
10
|
+
|
11
|
+
This class provides methods to load ASCII art, format messages with ANSI colors,
|
12
|
+
and display installation-related information such as commands, version, and status.
|
13
|
+
|
14
|
+
Attributes
|
15
|
+
----------
|
16
|
+
None
|
17
|
+
|
18
|
+
Methods
|
19
|
+
-------
|
20
|
+
_loadAsciiFile(name: str) -> str
|
21
|
+
Loads an ASCII file from the static directory.
|
22
|
+
_ansiMessage(message: str) -> str
|
23
|
+
Formats a message with green ANSI color.
|
24
|
+
_ansiCommands() -> str
|
25
|
+
Formats a list of commands with yellow ANSI color.
|
26
|
+
_ansiVersion(version: str = None) -> str
|
27
|
+
Formats version information with green ANSI color.
|
28
|
+
_ansiTextGreen(text: str) -> str
|
29
|
+
Wraps text in green ANSI color.
|
30
|
+
_year() -> str
|
31
|
+
Returns the current year as a string.
|
32
|
+
_newVersion() -> str
|
33
|
+
Checks for a new version of Orionis and returns a formatted message.
|
34
|
+
_replacePlaceholders(content: str, message: str) -> str
|
35
|
+
Replaces placeholders in a string with dynamic content.
|
36
|
+
_fallbackAscii() -> str
|
37
|
+
Provides a fallback ASCII message if the file is not found.
|
38
|
+
printHelp()
|
39
|
+
Prints the help message with available commands.
|
40
|
+
printIcon()
|
41
|
+
Prints the Orionis icon with a motivational message.
|
42
|
+
printStartInstallation()
|
43
|
+
Prints the start of the installation message.
|
44
|
+
printEndInstallation()
|
45
|
+
Prints the end of the installation message.
|
46
|
+
"""
|
47
|
+
|
48
|
+
def _loadAsciiFile(self, name: str) -> str:
|
49
|
+
"""
|
50
|
+
Loads an ASCII file from the static directory.
|
51
|
+
|
52
|
+
Parameters
|
53
|
+
----------
|
54
|
+
name : str
|
55
|
+
The name of the ASCII file (without the .ascii extension).
|
56
|
+
|
57
|
+
Returns
|
58
|
+
-------
|
59
|
+
str
|
60
|
+
The content of the ASCII file.
|
61
|
+
|
62
|
+
Raises
|
63
|
+
------
|
64
|
+
FileNotFoundError
|
65
|
+
If the file does not exist.
|
66
|
+
"""
|
67
|
+
dir_path = os.path.dirname(__file__)
|
68
|
+
path = os.path.join(dir_path, '..', 'static', 'ascii', f"{name}.ascii")
|
69
|
+
try:
|
70
|
+
with open(path, 'r', encoding='utf-8') as file:
|
71
|
+
return file.read()
|
72
|
+
except FileNotFoundError:
|
73
|
+
raise FileNotFoundError(f"File {name}.ascii not found")
|
74
|
+
|
75
|
+
def _ansiMessage(self, message: str) -> str:
|
76
|
+
"""
|
77
|
+
Formats a message with green ANSI color.
|
78
|
+
|
79
|
+
Parameters
|
80
|
+
----------
|
81
|
+
message : str
|
82
|
+
The message to format.
|
83
|
+
|
84
|
+
Returns
|
85
|
+
-------
|
86
|
+
str
|
87
|
+
The formatted message.
|
88
|
+
"""
|
89
|
+
return "\033[92m{} \033[0m".format(message)
|
90
|
+
|
91
|
+
def _ansiCommands(self) -> str:
|
92
|
+
"""
|
93
|
+
Formats a list of commands with yellow ANSI color.
|
94
|
+
|
95
|
+
Returns
|
96
|
+
-------
|
97
|
+
str
|
98
|
+
The formatted list of commands.
|
99
|
+
"""
|
100
|
+
commands = [
|
101
|
+
{'name': 'orionis new <app_name>', 'description': 'Creates a new Orionis app with the specified name.'},
|
102
|
+
{'name': 'orionis --version', 'description': 'Displays the current version of Orionis.'},
|
103
|
+
{'name': 'orionis --upgrade', 'description': 'Upgrades Orionis to the latest version.'}
|
104
|
+
]
|
105
|
+
commands_array = [
|
106
|
+
"\033[1m\033[93m- {} :\033[0m {}".format(command['name'], command['description'])
|
107
|
+
for command in commands
|
108
|
+
]
|
109
|
+
return "\n".join(commands_array)
|
110
|
+
|
111
|
+
def _ansiVersion(self, version: str = None) -> str:
|
112
|
+
"""
|
113
|
+
Formats version information with green ANSI color.
|
114
|
+
|
115
|
+
Parameters
|
116
|
+
----------
|
117
|
+
version : str, optional
|
118
|
+
The latest version available. If None, assumes the current version is the latest.
|
119
|
+
|
120
|
+
Returns
|
121
|
+
-------
|
122
|
+
str
|
123
|
+
The formatted version message.
|
124
|
+
"""
|
125
|
+
if version:
|
126
|
+
return self._ansiTextGreen(f"A new version ({version}) is available. Please consider upgrading from the current version ({VERSION}).")
|
127
|
+
return self._ansiTextGreen("You are using the latest stable version available.")
|
128
|
+
|
129
|
+
def _ansiTextGreen(self, text: str) -> str:
|
130
|
+
"""
|
131
|
+
Wraps text in green ANSI color.
|
132
|
+
|
133
|
+
Parameters
|
134
|
+
----------
|
135
|
+
text : str
|
136
|
+
The text to format.
|
137
|
+
|
138
|
+
Returns
|
139
|
+
-------
|
140
|
+
str
|
141
|
+
The formatted text.
|
142
|
+
"""
|
143
|
+
return f"\u001b[32m{text}\u001b[0m"
|
144
|
+
|
145
|
+
def _year(self) -> str:
|
146
|
+
"""
|
147
|
+
Returns the current year as a string.
|
148
|
+
|
149
|
+
Returns
|
150
|
+
-------
|
151
|
+
str
|
152
|
+
The current year.
|
153
|
+
"""
|
154
|
+
return str(datetime.datetime.now().year)
|
155
|
+
|
156
|
+
def _newVersion(self) -> str:
|
157
|
+
"""
|
158
|
+
Checks for a new version of Orionis and returns a formatted message.
|
159
|
+
|
160
|
+
Returns
|
161
|
+
-------
|
162
|
+
str
|
163
|
+
The formatted version message.
|
164
|
+
"""
|
165
|
+
try:
|
166
|
+
response = requests.get(API, timeout=10)
|
167
|
+
response.raise_for_status()
|
168
|
+
data = response.json()
|
169
|
+
latest_version = data.get("info", {}).get("version")
|
170
|
+
if not latest_version:
|
171
|
+
raise ValueError("Version information not found in API response.")
|
172
|
+
if latest_version != VERSION:
|
173
|
+
return self._ansiVersion(latest_version)
|
174
|
+
return self._ansiVersion()
|
175
|
+
except (requests.RequestException, ValueError) as e:
|
176
|
+
return self._ansiVersion()
|
177
|
+
|
178
|
+
def _replacePlaceholders(self, content: str, message: str) -> str:
|
179
|
+
"""
|
180
|
+
Replaces placeholders in a string with dynamic content.
|
181
|
+
|
182
|
+
Parameters
|
183
|
+
----------
|
184
|
+
content : str
|
185
|
+
The string containing placeholders.
|
186
|
+
message : str
|
187
|
+
The message to replace the {{message}} placeholder.
|
188
|
+
|
189
|
+
Returns
|
190
|
+
-------
|
191
|
+
str
|
192
|
+
The string with placeholders replaced.
|
193
|
+
"""
|
194
|
+
return content.replace('{{version}}', VERSION) \
|
195
|
+
.replace('{{docs}}', DOCS) \
|
196
|
+
.replace('{{year}}', self._year()) \
|
197
|
+
.replace('{{message}}', self._ansiMessage(message)) \
|
198
|
+
.replace('{{commands}}', self._ansiCommands()) \
|
199
|
+
.replace('{{new_version}}', self._newVersion())
|
200
|
+
|
201
|
+
def _fallbackAscii(self) -> str:
|
202
|
+
"""
|
203
|
+
Provides a fallback ASCII message if the file is not found.
|
204
|
+
|
205
|
+
Returns
|
206
|
+
-------
|
207
|
+
str
|
208
|
+
The fallback message.
|
209
|
+
"""
|
210
|
+
return f"{NAME.upper()}\nVersion: {VERSION}\nDocs: {DOCS}"
|
211
|
+
|
212
|
+
def printHelp(self):
|
213
|
+
"""
|
214
|
+
Prints the help message with available commands.
|
215
|
+
|
216
|
+
If the ASCII file is not found, it falls back to a basic message.
|
217
|
+
"""
|
218
|
+
try:
|
219
|
+
content = self._loadAsciiFile('info')
|
220
|
+
output = self._replacePlaceholders(content, "The list of commands accepted by the Orionis interpreter are:")
|
221
|
+
print(output)
|
222
|
+
except FileNotFoundError:
|
223
|
+
output = self._fallbackAscii()
|
224
|
+
print(output)
|
225
|
+
|
226
|
+
def printIcon(self):
|
227
|
+
"""
|
228
|
+
Prints the Orionis icon with a motivational message.
|
229
|
+
|
230
|
+
If the ASCII file is not found, it falls back to a basic message.
|
231
|
+
"""
|
232
|
+
try:
|
233
|
+
content = self._loadAsciiFile('icon')
|
234
|
+
output = self._replacePlaceholders(content, "Python isn't just powerful; it’s thrilling.")
|
235
|
+
print(output)
|
236
|
+
except FileNotFoundError:
|
237
|
+
output = self._fallbackAscii()
|
238
|
+
print(output)
|
239
|
+
|
240
|
+
def printStartInstallation(self):
|
241
|
+
"""
|
242
|
+
Prints the start of the installation message.
|
243
|
+
|
244
|
+
Displays the Orionis icon and a thank you message.
|
245
|
+
"""
|
246
|
+
self.printIcon()
|
247
|
+
print(self._ansiTextGreen("Thank you for using the framework!"))
|
248
|
+
|
249
|
+
def printEndInstallation(self):
|
250
|
+
"""
|
251
|
+
Prints the end of the installation message.
|
252
|
+
|
253
|
+
Displays a welcome message and encourages the user to start using the framework.
|
254
|
+
"""
|
255
|
+
print(self._ansiTextGreen("Welcome aboard, the journey starts now. Let your imagination soar!"))
|
256
|
+
print("-------------------------------------------")
|
@@ -5,9 +5,11 @@ import shutil
|
|
5
5
|
import subprocess
|
6
6
|
from unicodedata import normalize
|
7
7
|
from orionis.framework import SKELETON, DOCS
|
8
|
-
from orionis.installer.
|
8
|
+
from orionis.installer.contracts.output import IInstallerOutput
|
9
|
+
from orionis.installer.contracts.setup import IInstallerSetup
|
10
|
+
from orionis.luminate.console.output.console import Console
|
9
11
|
|
10
|
-
class InstallerSetup:
|
12
|
+
class InstallerSetup(IInstallerSetup):
|
11
13
|
"""
|
12
14
|
A class to initialize a Orionis project by performing the following setup actions:
|
13
15
|
1. Sanitize the folder name.
|
@@ -33,19 +35,19 @@ class InstallerSetup:
|
|
33
35
|
The sanitized folder name for the application.
|
34
36
|
"""
|
35
37
|
|
36
|
-
def __init__(self, name: str = 'example-app'
|
38
|
+
def __init__(self, output : IInstallerOutput, name: str = 'example-app'):
|
37
39
|
"""
|
38
40
|
Initialize OrionislInit class.
|
39
41
|
|
40
42
|
Parameters
|
41
43
|
----------
|
42
|
-
output :
|
44
|
+
output : IInstallerOutput
|
43
45
|
An instance of InstallerOutput.
|
44
46
|
name_app : str, optional
|
45
47
|
Name of the application. If not provided, defaults to "example-app".
|
46
48
|
"""
|
47
|
-
self.
|
48
|
-
self.
|
49
|
+
self._output = output
|
50
|
+
self._output.printStartInstallation()
|
49
51
|
self.name_app_folder = self._sanitize_folder_name(name)
|
50
52
|
|
51
53
|
def _sanitize_folder_name(self, name: str) -> str:
|
@@ -106,6 +108,17 @@ class InstallerSetup:
|
|
106
108
|
|
107
109
|
return name
|
108
110
|
|
111
|
+
def _printInfo(self, message: str) -> None:
|
112
|
+
"""
|
113
|
+
Display an information message to the console.
|
114
|
+
|
115
|
+
Parameters
|
116
|
+
----------
|
117
|
+
message : str
|
118
|
+
The message to display.
|
119
|
+
"""
|
120
|
+
Console.info(message)
|
121
|
+
|
109
122
|
def handle(self):
|
110
123
|
"""
|
111
124
|
Executes the setup process for initializing the Orionis project.
|
@@ -131,19 +144,19 @@ class InstallerSetup:
|
|
131
144
|
raise ValueError(f"The folder '{self.name_app_folder}' already exists.")
|
132
145
|
|
133
146
|
# Clone the repository
|
134
|
-
self.
|
147
|
+
self._printInfo(f"Cloning the repository into '{self.name_app_folder}'... (Getting Latest Version)")
|
135
148
|
subprocess.run(["git", "clone", SKELETON, self.name_app_folder], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
136
|
-
self.
|
149
|
+
self._printInfo(f"Repository successfully cloned into '{self.name_app_folder}'.")
|
137
150
|
|
138
151
|
# Change to the project directory
|
139
152
|
project_path = os.path.join(os.getcwd(), self.name_app_folder)
|
140
153
|
os.chdir(project_path)
|
141
|
-
self.
|
154
|
+
self._printInfo(f"Entering directory '{self.name_app_folder}'.")
|
142
155
|
|
143
156
|
# Create a virtual environment
|
144
|
-
self.
|
157
|
+
self._printInfo("Creating virtual environment...")
|
145
158
|
subprocess.run([sys.executable, "-m", "venv", "venv"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
146
|
-
self.
|
159
|
+
self._printInfo("Virtual environment successfully created.")
|
147
160
|
|
148
161
|
# Virtual environment path
|
149
162
|
venv_path = os.path.join(project_path, "venv", "Scripts" if os.name == "nt" else "bin")
|
@@ -153,9 +166,9 @@ class InstallerSetup:
|
|
153
166
|
raise ValueError(f"'requirements.txt' not found. Please visit the Orionis Docs for more details: {DOCS}")
|
154
167
|
|
155
168
|
# Install dependencies from requirements.txt
|
156
|
-
self.
|
169
|
+
self._printInfo("Installing dependencies from 'requirements.txt'...")
|
157
170
|
subprocess.run([os.path.join(venv_path, "pip"), "install", "-r", "requirements.txt"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
158
|
-
self.
|
171
|
+
self._printInfo("Dependencies successfully installed.")
|
159
172
|
|
160
173
|
# Create .env
|
161
174
|
example_env_path = os.path.join(project_path, '.env.example')
|
@@ -170,10 +183,10 @@ class InstallerSetup:
|
|
170
183
|
subprocess.run(["git", "remote", "remove", "origin"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
171
184
|
|
172
185
|
# Finish Process Message
|
173
|
-
self.
|
174
|
-
self.
|
186
|
+
self._printInfo(f"Project '{self.name_app_folder}' successfully created at '{os.path.abspath(project_path)}'.")
|
187
|
+
self._output.printEndInstallation()
|
175
188
|
|
176
189
|
except subprocess.CalledProcessError as e:
|
177
190
|
raise ValueError(f"Error while executing command: {e}")
|
178
191
|
except Exception as e:
|
179
|
-
raise RuntimeError(f"An unexpected error occurred: {e}")
|
192
|
+
raise RuntimeError(f"An unexpected error occurred: {e}")
|
orionis/luminate/application.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import asyncio
|
2
1
|
from typing import Dict, List, Type
|
3
2
|
from orionis.luminate.contracts.application import IApplication
|
4
3
|
from orionis.luminate.contracts.container.container import IContainer
|
5
4
|
from orionis.luminate.contracts.foundation.bootstraper import IBootstrapper
|
6
|
-
from orionis.luminate.container.container import Container
|
7
5
|
from orionis.luminate.contracts.providers.service_provider import IServiceProvider
|
6
|
+
from orionis.luminate.container.container import Container
|
8
7
|
from orionis.luminate.foundation.config.config_bootstrapper import ConfigBootstrapper
|
9
8
|
from orionis.luminate.foundation.console.command_bootstrapper import CommandsBootstrapper
|
10
9
|
from orionis.luminate.foundation.environment.environment_bootstrapper import EnvironmentBootstrapper
|
11
10
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
12
11
|
from orionis.luminate.foundation.providers.service_providers_bootstrapper import ServiceProvidersBootstrapper
|
13
12
|
from orionis.luminate.patterns.singleton import SingletonMeta
|
13
|
+
from orionis.luminate.support.asyn_run import AsyncExecutor
|
14
14
|
|
15
15
|
class Application(metaclass=SingletonMeta):
|
16
16
|
"""
|
@@ -135,13 +135,7 @@ class Application(metaclass=SingletonMeta):
|
|
135
135
|
self._loadCommands()
|
136
136
|
|
137
137
|
# Boot service providers
|
138
|
-
|
139
|
-
loop = asyncio.get_running_loop()
|
140
|
-
loop.run_until_complete(self._bootServiceProviders())
|
141
|
-
except RuntimeError:
|
142
|
-
loop = asyncio.new_event_loop()
|
143
|
-
asyncio.set_event_loop(loop)
|
144
|
-
loop.run_until_complete(self._bootServiceProviders())
|
138
|
+
AsyncExecutor.run(self._bootServiceProviders())
|
145
139
|
|
146
140
|
# Change the application status to booted
|
147
141
|
Application.boot()
|
@@ -1,13 +1,5 @@
|
|
1
1
|
from orionis.luminate.contracts.console.command_filter import ICommandFilter
|
2
2
|
|
3
|
-
# List of commands to exclude from output formatting
|
4
|
-
EXCLUDED_COMMANDS = [
|
5
|
-
'schedule:work', # Command to handle scheduled work
|
6
|
-
'help', # Command to show help information
|
7
|
-
'version', # Command to display version information
|
8
|
-
'tests:run' # Command to run tests
|
9
|
-
]
|
10
|
-
|
11
3
|
class CommandFilter(ICommandFilter):
|
12
4
|
"""
|
13
5
|
CommandFilter handles the exclusion of specific commands from output formatting.
|
@@ -37,4 +29,9 @@ class CommandFilter(ICommandFilter):
|
|
37
29
|
bool
|
38
30
|
Returns True if the command is excluded from output formatting, False otherwise.
|
39
31
|
"""
|
40
|
-
return command in
|
32
|
+
return command in [
|
33
|
+
'schedule:work', # Command to handle scheduled work
|
34
|
+
'help', # Command to show help information
|
35
|
+
'version', # Command to display version information
|
36
|
+
'tests:run' # Command to run tests
|
37
|
+
]
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from orionis.luminate.console.base.command import BaseCommand
|
2
2
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
3
|
-
from orionis.luminate.container.resolve import Resolve
|
4
3
|
from orionis.luminate.contracts.application import IApplication
|
5
4
|
|
6
5
|
class HelpCommand(BaseCommand):
|
@@ -9,6 +8,9 @@ class HelpCommand(BaseCommand):
|
|
9
8
|
|
10
9
|
This command fetches all registered commands from the cache and presents them in a table format.
|
11
10
|
"""
|
11
|
+
def __init__(self, app : IApplication):
|
12
|
+
# Get the list of commands from the container
|
13
|
+
self._commands : dict = app._commands if hasattr(app, '_commands') else {}
|
12
14
|
|
13
15
|
# Command signature used for execution.
|
14
16
|
signature = "help"
|
@@ -35,15 +37,9 @@ class HelpCommand(BaseCommand):
|
|
35
37
|
self.newLine()
|
36
38
|
self.textSuccessBold(" (CLI Interpreter) Available Commands: ")
|
37
39
|
|
38
|
-
# Fetch the commands from the Application
|
39
|
-
app = Resolve(IApplication)
|
40
|
-
|
41
|
-
# Get the list of commands from the container
|
42
|
-
commands : dict = app._commands if hasattr(app, '_commands') else {}
|
43
|
-
|
44
40
|
# Initialize an empty list to store the rows.
|
45
41
|
rows = []
|
46
|
-
for signature, command_data in
|
42
|
+
for signature, command_data in self._commands.items():
|
47
43
|
rows.append([signature, command_data['description']])
|
48
44
|
|
49
45
|
# Sort commands alphabetically
|
@@ -19,7 +19,7 @@ class ScheduleWorkCommand(BaseCommand):
|
|
19
19
|
# A brief description of the command.
|
20
20
|
description = "Starts the scheduled tasks."
|
21
21
|
|
22
|
-
def __init__(self, schedule:Schedule) -> None:
|
22
|
+
def __init__(self, schedule : Schedule) -> None:
|
23
23
|
"""
|
24
24
|
Initialize a new instance of the ScheduleWorkCommand class.
|
25
25
|
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import asyncio
|
2
1
|
from typing import Any, Callable
|
3
|
-
from orionis.luminate.application import Application
|
4
2
|
from orionis.luminate.container.container import Container
|
5
3
|
from orionis.luminate.container.exception import OrionisContainerValueError
|
4
|
+
from orionis.luminate.support.asyn_run import AsyncExecutor
|
6
5
|
|
7
6
|
class Resolve:
|
8
7
|
"""
|
@@ -63,10 +62,4 @@ class Resolve:
|
|
63
62
|
)
|
64
63
|
|
65
64
|
# Resolve and return the service associated with the abstract or alias
|
66
|
-
|
67
|
-
loop = asyncio.get_running_loop()
|
68
|
-
return loop.run_until_complete(container.make(abstract_or_alias))
|
69
|
-
except RuntimeError:
|
70
|
-
loop = asyncio.new_event_loop()
|
71
|
-
asyncio.set_event_loop(loop)
|
72
|
-
return loop.run_until_complete(container.make(abstract_or_alias))
|
65
|
+
AsyncExecutor.run(container.make(abstract_or_alias))
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import time
|
2
2
|
from typing import Any, Dict, Optional
|
3
|
-
from orionis.luminate.container.resolve import Resolve
|
4
3
|
from orionis.luminate.console.base.command import BaseCommand
|
5
4
|
from orionis.luminate.console.command_filter import CommandFilter
|
6
5
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisException
|
@@ -21,7 +20,7 @@ class ReactorCommandsService:
|
|
21
20
|
- Managing execution timing and error handling.
|
22
21
|
"""
|
23
22
|
|
24
|
-
def __init__(self, command_filter: CommandFilter, log: Log, executor: Executor, console: Console, app
|
23
|
+
def __init__(self, command_filter: CommandFilter, log: Log, executor: Executor, console: Console, app : IApplication) -> None:
|
25
24
|
"""
|
26
25
|
Initializes the ReactorCommandsService instance.
|
27
26
|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import copy
|
2
2
|
from typing import Any, Optional
|
3
|
-
from orionis.luminate.container.resolve import Resolve
|
4
3
|
from orionis.luminate.contracts.application import IApplication
|
5
4
|
|
6
5
|
class ConfigService:
|
7
6
|
|
8
|
-
def __init__(self, app
|
7
|
+
def __init__(self, app : IApplication) -> None:
|
9
8
|
"""
|
10
9
|
Initializes the ConfigService with the provided configuration.
|
11
10
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import asyncio
|
2
|
+
|
3
|
+
class AsyncExecutor:
|
4
|
+
|
5
|
+
@staticmethod
|
6
|
+
def run(callback: asyncio.coroutine) -> None:
|
7
|
+
"""
|
8
|
+
Runs a coroutine synchronously.
|
9
|
+
|
10
|
+
Parameters
|
11
|
+
----------
|
12
|
+
callback : asyncio.coroutine
|
13
|
+
The coroutine to run.
|
14
|
+
"""
|
15
|
+
try:
|
16
|
+
loop = asyncio.get_running_loop()
|
17
|
+
loop.run_until_complete(callback)
|
18
|
+
except RuntimeError:
|
19
|
+
loop = asyncio.new_event_loop()
|
20
|
+
asyncio.set_event_loop(loop)
|
21
|
+
loop.run_until_complete(callback)
|
orionis/static/ascii/icon.ascii
CHANGED
orionis/static/ascii/info.ascii
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
orionis/
|
3
|
-
orionis/framework.py,sha256=
|
2
|
+
orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
|
3
|
+
orionis/framework.py,sha256=0611cXKwFgBp_InJXtHI-KpPr1yPTLckwUHLG2TzZkk,1469
|
4
4
|
orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
orionis/installer/manager.py,sha256=
|
6
|
-
orionis/installer/
|
5
|
+
orionis/installer/manager.py,sha256=SYP-k_3c2oxFOCCWfMz-wnekWivn3VcFVMUU5e_sJYo,2787
|
6
|
+
orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
|
7
|
+
orionis/installer/setup.py,sha256=xP9y84S4OuEp8wrsZInQz3pS8nenIEPQU2sYUrKyJNg,7383
|
7
8
|
orionis/installer/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
orionis/installer/contracts/
|
9
|
-
orionis/installer/contracts/
|
10
|
-
orionis/installer/contracts/
|
11
|
-
orionis/installer/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
orionis/installer/output/output.py,sha256=3xLaE5uREQICshhGLuqbW4d2NbANkrlKRKkWCs_ZBwQ,8154
|
13
|
-
orionis/installer/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
orionis/installer/setup/setup.py,sha256=zAZDelFwieZ9HbR_mSgvW9-gI--Zzu__6SZWWw4VEE8,6967
|
9
|
+
orionis/installer/contracts/manager.py,sha256=Zfndhuyu0JaTKo3PsGsKmVsvotQMw8Pmt4KQp97elY8,1567
|
10
|
+
orionis/installer/contracts/output.py,sha256=t1KLw610-hHy63UbFFE2BYwWHWRbW8_ofuEvRLx_IUE,983
|
11
|
+
orionis/installer/contracts/setup.py,sha256=aWYkCv-z48bXXZynYapc3uMIE1gyO6XnkTw3b4MTBq4,784
|
15
12
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
orionis/luminate/application.py,sha256=
|
13
|
+
orionis/luminate/application.py,sha256=jQ0fyP54yIs-BqT47gogqmzOHi6mJ4X2-bhCERwU5kc,6936
|
17
14
|
orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
15
|
orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
|
19
16
|
orionis/luminate/config/auth.py,sha256=CG8F0pfVjKz4DY3d1Wi7gscdhnp4TT-Q8SJ2sdsHh18,523
|
@@ -26,15 +23,15 @@ orionis/luminate/config/mail.py,sha256=3iYXG72bXiVns4sEPZ_A3-cGcFjGEGDXkuLKkk-hK
|
|
26
23
|
orionis/luminate/config/queue.py,sha256=DYjP5zD09ISsIX117wtOfjiG_iQrcrPoQVeeftmuO3c,1739
|
27
24
|
orionis/luminate/config/session.py,sha256=7mOC_DfGIBDqAClSiewHoTA9Kht_zdHApvALcZc7cfY,1861
|
28
25
|
orionis/luminate/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
orionis/luminate/console/command_filter.py,sha256=
|
26
|
+
orionis/luminate/console/command_filter.py,sha256=fmqjQZFwhsEMKWuTtt4dIQF-souVSJk1ksO3UqV7sis,1274
|
30
27
|
orionis/luminate/console/kernel.py,sha256=knzOpbsHJJpAbCSrnFXgRHK9Uk4OisEW_jiylaR-PLA,891
|
31
28
|
orionis/luminate/console/parser.py,sha256=jQPDYHvGt-h2qnmDUObaxF9CmuX9YK_8XTYnQwKCSXE,5586
|
32
29
|
orionis/luminate/console/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
30
|
orionis/luminate/console/base/command.py,sha256=K-Jv3OTVenyrpTI2Jov-WQ435CA4tgqMy6sztxYKDFA,12674
|
34
31
|
orionis/luminate/console/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
32
|
orionis/luminate/console/commands/cache_clear.py,sha256=UV2VFFK-LsUNDrqKb_Q8HWnwlwvIuTWTsbQ5x5rWHGk,2859
|
36
|
-
orionis/luminate/console/commands/help.py,sha256=
|
37
|
-
orionis/luminate/console/commands/schedule_work.py,sha256=
|
33
|
+
orionis/luminate/console/commands/help.py,sha256=3Sc_nXCA9RFiFvvVUkUjVu3CSLit1JSflt2akP7xtN4,2224
|
34
|
+
orionis/luminate/console/commands/schedule_work.py,sha256=eYF94qgNjjAGLoN4JWA0e0zeNWc3fptj2NY2O7KGGGU,2174
|
38
35
|
orionis/luminate/console/commands/tests.py,sha256=Z7e6aM5Vu8C7R8iC8sJgUYVN9aJgtVMkqjUEFxPq91o,1281
|
39
36
|
orionis/luminate/console/commands/version.py,sha256=llVPK6ELtf8dIdPvLbybrtipWwZkzV0EXc9ShL-C-GY,1140
|
40
37
|
orionis/luminate/console/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -49,7 +46,7 @@ orionis/luminate/container/container.py,sha256=9xdODX1h4YK6V-THrfgm5XN95imobExzr
|
|
49
46
|
orionis/luminate/container/container_integrity.py,sha256=lFQ41IN_3Z0SbtJzZ_9jewoaUI4xlsBEFXPfn-p82uI,7976
|
50
47
|
orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
|
51
48
|
orionis/luminate/container/lifetimes.py,sha256=2lbdiV7R2WlJf1cLD6eBxLnJud_lZvX1IhQH2Djy3Ww,375
|
52
|
-
orionis/luminate/container/resolve.py,sha256=
|
49
|
+
orionis/luminate/container/resolve.py,sha256=PbeHc14fJSnn1z5B6aD-MBDkTyje9E2dKVPRw0TYW-Y,2299
|
53
50
|
orionis/luminate/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
51
|
orionis/luminate/contracts/application.py,sha256=FIR6WMY0y-Hkjp0jWfjJV9kwIqBb-RB1-Jl0GWCk9eI,1077
|
55
52
|
orionis/luminate/contracts/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -152,16 +149,17 @@ orionis/luminate/providers/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
152
149
|
orionis/luminate/providers/log/log_service_provider.py,sha256=4mXkd9kTKW8dsqe6ScbEDO7b6GsFgAfu9vFJNjECZlw,740
|
153
150
|
orionis/luminate/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
154
151
|
orionis/luminate/services/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
155
|
-
orionis/luminate/services/commands/reactor_commands_service.py,sha256=
|
152
|
+
orionis/luminate/services/commands/reactor_commands_service.py,sha256=W021KVkIIVVkS16oaxrC5Vz2qR9Ji_pbvoNaLBFJR1E,6214
|
156
153
|
orionis/luminate/services/commands/scheduler_service.py,sha256=bOovnY83aZPfDz7XhGv4mQXVV116l_9UeaCstA89i_8,22474
|
157
154
|
orionis/luminate/services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
158
|
-
orionis/luminate/services/config/config_service.py,sha256=
|
155
|
+
orionis/luminate/services/config/config_service.py,sha256=RKZ194_0RAEkRFSm3OPoDDdme0_wyBZNLaEQhIVdbYk,2114
|
159
156
|
orionis/luminate/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
160
157
|
orionis/luminate/services/environment/environment_service.py,sha256=GdrXWmOK2lWpa6GkIwFI8kHee5hQel_cIF9sduRfGfo,4776
|
161
158
|
orionis/luminate/services/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
162
159
|
orionis/luminate/services/files/path_resolver_service.py,sha256=gCGVLtdXGuEIE6I8tm6JEB84HS1Fa5rk2whO2R6u8Wc,1698
|
163
160
|
orionis/luminate/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
164
161
|
orionis/luminate/services/log/log_service.py,sha256=7KZ9i5RGquUqRADTa7T61v4kTu_qjDOVyaoGvm_51f0,8291
|
162
|
+
orionis/luminate/support/asyn_run.py,sha256=Se2A0UvuOuS_zo7V1AycEjRKpfV6m-1pN9h7Xi2MHMQ,564
|
165
163
|
orionis/luminate/support/dot_dict.py,sha256=FVHfBuAGTTVMjNG01Fix645fRNKKUMmNx61pYkxPL5c,1253
|
166
164
|
orionis/luminate/support/exception_to_dict.py,sha256=OV3vWZ6Dlh3EnFurR_7zhR3mfXDZg-UFbMsfs4tNnLA,2105
|
167
165
|
orionis/luminate/support/reflection.py,sha256=TbWZ_cer0PXrPlwCYFbUJRymlzYxXT0E4C5XCsSc3mw,11951
|
@@ -169,8 +167,8 @@ orionis/luminate/support/std.py,sha256=TqrgMxF_i5ubYGT5LOvHCH7HOHNmI8CE1kG9pNoSn
|
|
169
167
|
orionis/luminate/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
170
168
|
orionis/luminate/test/exception.py,sha256=VJaZ7VMZfdKW1ov_GwKp2HAz_NYobujJxDt5RaPHuVQ,1395
|
171
169
|
orionis/luminate/test/unit_test.py,sha256=7pZWRYRtLRz5_EZBWuXHZShRm7y5ICtl-52FTrsUqso,3652
|
172
|
-
orionis/static/ascii/icon.ascii,sha256=
|
173
|
-
orionis/static/ascii/info.ascii,sha256=
|
170
|
+
orionis/static/ascii/icon.ascii,sha256=IgrlVjcYxcCrr0cJuJkOnEz0aEdAQBTyLzO5ainKsWc,398
|
171
|
+
orionis/static/ascii/info.ascii,sha256=HF_o2eXaiw5iqcOhHfnPByn5GJ_O2eBwSK3IpTfYOwY,457
|
174
172
|
orionis/static/bg/galaxy.jpg,sha256=_FuPghOe9LBrIWv1eKZ9fiZR72sEz5obvXGDnD7MzTc,172244
|
175
173
|
orionis/static/favicon/OrionisFrameworkFavicon.png,sha256=bvkLzn0PfYHY9f-AfgRzclt4RNSFaKhMCH_TgwqsMKU,31301
|
176
174
|
orionis/static/logos/OrionisFramework.jpg,sha256=ezZlrcoknKvtl6YFwSIVfecRFm9fjAMKXHmuabMpImM,716918
|
@@ -182,9 +180,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
182
180
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
183
181
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
184
182
|
tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
|
185
|
-
orionis-0.
|
186
|
-
orionis-0.
|
187
|
-
orionis-0.
|
188
|
-
orionis-0.
|
189
|
-
orionis-0.
|
190
|
-
orionis-0.
|
183
|
+
orionis-0.183.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
184
|
+
orionis-0.183.0.dist-info/METADATA,sha256=nvk7FryxtICA1oS71ijwfRCYd1Igcjdkxy1BiQhOetI,3003
|
185
|
+
orionis-0.183.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
186
|
+
orionis-0.183.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
187
|
+
orionis-0.183.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
188
|
+
orionis-0.183.0.dist-info/RECORD,,
|
@@ -1,101 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
class IInstallerOutput(ABC):
|
4
|
-
"""
|
5
|
-
Interface for the InstallerOutput class.
|
6
|
-
"""
|
7
|
-
|
8
|
-
@abstractmethod
|
9
|
-
def _print(label: str, message: str, color_code: str):
|
10
|
-
"""
|
11
|
-
Prints messages to the console with specific formatting and colors.
|
12
|
-
|
13
|
-
Parameters
|
14
|
-
----------
|
15
|
-
label : str
|
16
|
-
The label for the message (e.g., INFO, FAIL, ERROR).
|
17
|
-
message : str
|
18
|
-
The message to display.
|
19
|
-
color_code : str
|
20
|
-
ANSI color code for the background of the message.
|
21
|
-
"""
|
22
|
-
pass
|
23
|
-
|
24
|
-
@abstractmethod
|
25
|
-
def asciiIco():
|
26
|
-
"""
|
27
|
-
Displays a welcome message to the framework, including ASCII art.
|
28
|
-
|
29
|
-
Attempts to load an ASCII art file (art.ascii). If not found, defaults to displaying basic information.
|
30
|
-
|
31
|
-
If the ASCII art file is found, placeholders are replaced with dynamic content such as version, docs, and year.
|
32
|
-
"""
|
33
|
-
pass
|
34
|
-
|
35
|
-
@abstractmethod
|
36
|
-
def asciiInfo():
|
37
|
-
"""
|
38
|
-
Displays another type of welcome message to the framework, including different ASCII art.
|
39
|
-
|
40
|
-
Attempts to load an ASCII art file (info.ascii). If not found, defaults to displaying basic information.
|
41
|
-
|
42
|
-
Similar to `asciiIco()`, but with different ASCII art.
|
43
|
-
"""
|
44
|
-
pass
|
45
|
-
|
46
|
-
@abstractmethod
|
47
|
-
def startInstallation():
|
48
|
-
"""
|
49
|
-
Displays the starting message when the installation begins.
|
50
|
-
This includes a welcoming message and the ASCII art.
|
51
|
-
"""
|
52
|
-
pass
|
53
|
-
|
54
|
-
@abstractmethod
|
55
|
-
def endInstallation():
|
56
|
-
"""
|
57
|
-
Displays the ending message after the installation is complete.
|
58
|
-
Provides a message of encouragement to start using the framework.
|
59
|
-
"""
|
60
|
-
pass
|
61
|
-
|
62
|
-
@abstractmethod
|
63
|
-
def info(message: str = ''):
|
64
|
-
"""
|
65
|
-
Displays an informational message to the console.
|
66
|
-
|
67
|
-
Parameters
|
68
|
-
----------
|
69
|
-
message : str, optional
|
70
|
-
The message to display. Defaults to an empty string.
|
71
|
-
"""
|
72
|
-
pass
|
73
|
-
|
74
|
-
@abstractmethod
|
75
|
-
def fail(message: str = ''):
|
76
|
-
"""
|
77
|
-
Displays a failure message to the console.
|
78
|
-
|
79
|
-
Parameters
|
80
|
-
----------
|
81
|
-
message : str, optional
|
82
|
-
The message to display. Defaults to an empty string.
|
83
|
-
"""
|
84
|
-
pass
|
85
|
-
|
86
|
-
@abstractmethod
|
87
|
-
def error(message: str = '', e = None):
|
88
|
-
"""
|
89
|
-
Displays an error message to the console and terminates the program.
|
90
|
-
|
91
|
-
Parameters
|
92
|
-
----------
|
93
|
-
message : str, optional
|
94
|
-
The message to display. Defaults to an empty string.
|
95
|
-
|
96
|
-
Raises
|
97
|
-
------
|
98
|
-
SystemExit
|
99
|
-
Terminates the program with a non-zero exit code, indicating an error occurred.
|
100
|
-
"""
|
101
|
-
pass
|
@@ -1,59 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
class InstallerSetup(ABC):
|
4
|
-
"""
|
5
|
-
Interface for the InstallerSetup class.
|
6
|
-
"""
|
7
|
-
|
8
|
-
@abstractmethod
|
9
|
-
def _sanitize_folder_name(self, name: str) -> str:
|
10
|
-
"""
|
11
|
-
Sanitize the provided folder name to ensure it is valid across different operating systems.
|
12
|
-
|
13
|
-
Steps:
|
14
|
-
1. Normalize text to remove accents and special characters.
|
15
|
-
2. Convert to lowercase.
|
16
|
-
3. Replace spaces with underscores.
|
17
|
-
4. Remove invalid characters.
|
18
|
-
5. Strip leading and trailing whitespace.
|
19
|
-
6. Enforce length limit (255 characters).
|
20
|
-
7. Ensure the result contains only valid characters.
|
21
|
-
|
22
|
-
Parameters
|
23
|
-
----------
|
24
|
-
name : str
|
25
|
-
The original folder name to sanitize.
|
26
|
-
|
27
|
-
Returns
|
28
|
-
-------
|
29
|
-
str
|
30
|
-
The sanitized folder name.
|
31
|
-
|
32
|
-
Raises
|
33
|
-
------
|
34
|
-
ValueError
|
35
|
-
If the sanitized folder name is empty or contains invalid characters.
|
36
|
-
"""
|
37
|
-
pass
|
38
|
-
|
39
|
-
@abstractmethod
|
40
|
-
def handle(self):
|
41
|
-
"""
|
42
|
-
Executes the setup process for initializing the Orionis project.
|
43
|
-
|
44
|
-
This process includes:
|
45
|
-
1. Cloning the repository.
|
46
|
-
2. Creating a virtual environment.
|
47
|
-
3. Installing dependencies from requirements.txt.
|
48
|
-
4. Setting up the .env file.
|
49
|
-
5. Generating an API key.
|
50
|
-
6. Cleaning up temporary files and .git remote origin.
|
51
|
-
|
52
|
-
Raises
|
53
|
-
------
|
54
|
-
ValueError
|
55
|
-
If there is an error during any subprocess execution.
|
56
|
-
Exception
|
57
|
-
If any unexpected error occurs.
|
58
|
-
"""
|
59
|
-
pass
|
File without changes
|
@@ -1,218 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import sys
|
3
|
-
import datetime
|
4
|
-
import traceback
|
5
|
-
from orionis.framework import NAME, VERSION, DOCS
|
6
|
-
from orionis.installer.contracts.installer_output import IInstallerOutput
|
7
|
-
from orionis.installer.version import check_version
|
8
|
-
|
9
|
-
class InstallerOutput(IInstallerOutput):
|
10
|
-
"""
|
11
|
-
Class for displaying various types of messages to the console, including:
|
12
|
-
- Welcome messages
|
13
|
-
- Informational messages
|
14
|
-
- Failure messages
|
15
|
-
- Error messages
|
16
|
-
|
17
|
-
Methods
|
18
|
-
-------
|
19
|
-
welcome() -> None
|
20
|
-
Displays a welcome message to the framework.
|
21
|
-
finished() -> None
|
22
|
-
Displays a success message after initialization.
|
23
|
-
info(message: str) -> None
|
24
|
-
Displays an informational message to the console.
|
25
|
-
fail(message: str) -> None
|
26
|
-
Displays a failure message to the console.
|
27
|
-
error(message: str) -> None
|
28
|
-
Displays an error message to the console and terminates the program.
|
29
|
-
"""
|
30
|
-
|
31
|
-
@staticmethod
|
32
|
-
def _print(label: str, message: str, color_code: str):
|
33
|
-
"""
|
34
|
-
Prints messages to the console with specific formatting and colors.
|
35
|
-
|
36
|
-
Parameters
|
37
|
-
----------
|
38
|
-
label : str
|
39
|
-
The label for the message (e.g., INFO, FAIL, ERROR).
|
40
|
-
message : str
|
41
|
-
The message to display.
|
42
|
-
color_code : str
|
43
|
-
ANSI color code for the background of the message.
|
44
|
-
"""
|
45
|
-
# Get the current timestamp to display with the message
|
46
|
-
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
47
|
-
|
48
|
-
# Print the formatted message with the specified color and label
|
49
|
-
print(f'\u001b[{color_code}m\u001b[97m {label} \u001b[0m {timestamp} [Orionis Framework] - {message}\u001b[0m')
|
50
|
-
|
51
|
-
@staticmethod
|
52
|
-
def checkVersion():
|
53
|
-
"""
|
54
|
-
Checks the current API version and compares it with the installed version.
|
55
|
-
|
56
|
-
Returns
|
57
|
-
-------
|
58
|
-
str
|
59
|
-
The latest available version from the API.
|
60
|
-
"""
|
61
|
-
version = check_version()
|
62
|
-
if version:
|
63
|
-
if version != VERSION:
|
64
|
-
print(f"\u001b[32mA new version ({version}) is available. Please consider upgrading from the current version ({VERSION}).\u001b[0m")
|
65
|
-
|
66
|
-
@staticmethod
|
67
|
-
def asciiIco():
|
68
|
-
"""
|
69
|
-
Displays a welcome message to the framework, including ASCII art.
|
70
|
-
|
71
|
-
Attempts to load an ASCII art file (art.ascii). If not found, defaults to displaying basic information.
|
72
|
-
|
73
|
-
If the ASCII art file is found, placeholders are replaced with dynamic content such as version, docs, and year.
|
74
|
-
"""
|
75
|
-
|
76
|
-
try:
|
77
|
-
# Try loading and printing ASCII art from the file
|
78
|
-
dir_path = os.path.dirname(__file__)
|
79
|
-
path = os.path.join(dir_path, '..', '..', 'static', 'ascii', 'icon.ascii')
|
80
|
-
with open(path, 'r', encoding='utf-8') as file:
|
81
|
-
content = file.read()
|
82
|
-
|
83
|
-
# Replace placeholders with dynamic content
|
84
|
-
year = datetime.datetime.now().year
|
85
|
-
message = "\u001b[32m{} \u001b[0m".format("Python isn't just powerful; it’s thrilling.")
|
86
|
-
output = content.replace('{{version}}', VERSION) \
|
87
|
-
.replace('{{docs}}', DOCS) \
|
88
|
-
.replace('{{year}}', str(year)) \
|
89
|
-
.replace('{{message}}', message)
|
90
|
-
print(output)
|
91
|
-
|
92
|
-
# Check the current version
|
93
|
-
InstallerOutput.checkVersion()
|
94
|
-
|
95
|
-
except FileNotFoundError:
|
96
|
-
# Fallback if ASCII art file is not found
|
97
|
-
print(str(NAME).upper())
|
98
|
-
print(f"Version: {VERSION}")
|
99
|
-
print(f"Docs: {DOCS}")
|
100
|
-
|
101
|
-
# Check the current version
|
102
|
-
InstallerOutput.checkVersion()
|
103
|
-
|
104
|
-
@staticmethod
|
105
|
-
def asciiInfo():
|
106
|
-
"""
|
107
|
-
Displays another type of welcome message to the framework, including different ASCII art.
|
108
|
-
|
109
|
-
Attempts to load an ASCII art file (info.ascii). If not found, defaults to displaying basic information.
|
110
|
-
|
111
|
-
Similar to `asciiIco()`, but with different ASCII art.
|
112
|
-
"""
|
113
|
-
try:
|
114
|
-
# Try loading and printing ASCII art from the file
|
115
|
-
dir_path = os.path.dirname(__file__)
|
116
|
-
path = os.path.join(dir_path, '..', '..', 'static', 'ascii', 'info.ascii')
|
117
|
-
with open(path, 'r', encoding='utf-8') as file:
|
118
|
-
content = file.read()
|
119
|
-
|
120
|
-
# Replace placeholders with dynamic content
|
121
|
-
year = datetime.datetime.now().year
|
122
|
-
message = "\033[92m{} \033[0m".format("The list of commands accepted by the Orionis interpreter are:")
|
123
|
-
commands = [
|
124
|
-
{'name':'orionis new <app_name>', 'description': 'Creates a new Orionis app with the specified name.'},
|
125
|
-
{'name':'orionis --version', 'description': 'Displays the current version of Orionis.'},
|
126
|
-
{'name':'orionis --upgrade', 'description': 'Upgrades Orionis to the latest version.'}
|
127
|
-
]
|
128
|
-
commands_array = []
|
129
|
-
for command in commands:
|
130
|
-
commands_array.append("\033[1m\033[93m- {} :\033[0m {}".format(command['name'],command['description']))
|
131
|
-
|
132
|
-
output = content.replace('{{version}}', VERSION) \
|
133
|
-
.replace('{{docs}}', DOCS) \
|
134
|
-
.replace('{{year}}', str(year))\
|
135
|
-
.replace('{{message}}', message)\
|
136
|
-
.replace('{{commands}}', str("\n").join(commands_array))
|
137
|
-
print(output)
|
138
|
-
|
139
|
-
# Check the current version
|
140
|
-
InstallerOutput.checkVersion()
|
141
|
-
|
142
|
-
except FileNotFoundError:
|
143
|
-
# Fallback if ASCII art file is not found
|
144
|
-
print(str(NAME).upper())
|
145
|
-
print(f"Version: {VERSION}")
|
146
|
-
print(f"Docs: {DOCS}")
|
147
|
-
|
148
|
-
# Check the current version
|
149
|
-
InstallerOutput.checkVersion()
|
150
|
-
|
151
|
-
@staticmethod
|
152
|
-
def startInstallation():
|
153
|
-
"""
|
154
|
-
Displays the starting message when the installation begins.
|
155
|
-
This includes a welcoming message and the ASCII art.
|
156
|
-
"""
|
157
|
-
InstallerOutput.asciiIco()
|
158
|
-
print(f'\u001b[32mThank you for using the framework!\u001b[0m')
|
159
|
-
|
160
|
-
# Check the current version
|
161
|
-
InstallerOutput.checkVersion()
|
162
|
-
|
163
|
-
@staticmethod
|
164
|
-
def endInstallation():
|
165
|
-
"""
|
166
|
-
Displays the ending message after the installation is complete.
|
167
|
-
Provides a message of encouragement to start using the framework.
|
168
|
-
"""
|
169
|
-
print(f'\u001b[32mWelcome aboard, the journey starts now. Let your imagination soar!\u001b[0m')
|
170
|
-
print("-------------------------------------------")
|
171
|
-
|
172
|
-
@staticmethod
|
173
|
-
def info(message: str = ''):
|
174
|
-
"""
|
175
|
-
Displays an informational message to the console.
|
176
|
-
|
177
|
-
Parameters
|
178
|
-
----------
|
179
|
-
message : str, optional
|
180
|
-
The message to display. Defaults to an empty string.
|
181
|
-
"""
|
182
|
-
InstallerOutput._print("INFO", message, "44")
|
183
|
-
|
184
|
-
@staticmethod
|
185
|
-
def fail(message: str = ''):
|
186
|
-
"""
|
187
|
-
Displays a failure message to the console.
|
188
|
-
|
189
|
-
Parameters
|
190
|
-
----------
|
191
|
-
message : str, optional
|
192
|
-
The message to display. Defaults to an empty string.
|
193
|
-
"""
|
194
|
-
InstallerOutput._print("FAIL", message, "43")
|
195
|
-
|
196
|
-
@staticmethod
|
197
|
-
def error(message: str = '', e = None):
|
198
|
-
"""
|
199
|
-
Displays an error message to the console and terminates the program.
|
200
|
-
|
201
|
-
Parameters
|
202
|
-
----------
|
203
|
-
message : str, optional
|
204
|
-
The message to display. Defaults to an empty string.
|
205
|
-
|
206
|
-
Raises
|
207
|
-
------
|
208
|
-
SystemExit
|
209
|
-
Terminates the program with a non-zero exit code, indicating an error occurred.
|
210
|
-
"""
|
211
|
-
|
212
|
-
InstallerOutput._print("ERROR", message, "41")
|
213
|
-
|
214
|
-
if isinstance(e, BaseException):
|
215
|
-
print("\n--- Traceback (most recent call last) ---")
|
216
|
-
traceback.print_exc()
|
217
|
-
|
218
|
-
sys.exit(1)
|
File without changes
|
orionis/installer/version.py
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import requests
|
2
|
-
from orionis.framework import API
|
3
|
-
|
4
|
-
def check_version():
|
5
|
-
"""
|
6
|
-
Checks the current API version and compares it with the installed version.
|
7
|
-
|
8
|
-
Returns
|
9
|
-
-------
|
10
|
-
str
|
11
|
-
The latest available version from the API.
|
12
|
-
"""
|
13
|
-
try:
|
14
|
-
|
15
|
-
response = requests.get(API, timeout=10)
|
16
|
-
response.raise_for_status()
|
17
|
-
data = response.json()
|
18
|
-
latest_version = data.get("info", {}).get("version")
|
19
|
-
|
20
|
-
if not latest_version:
|
21
|
-
raise ValueError("Version information not found in API response.")
|
22
|
-
|
23
|
-
return latest_version
|
24
|
-
|
25
|
-
except requests.RequestException as e:
|
26
|
-
|
27
|
-
return None
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|