Added publish logic

This commit is contained in:
Sven Heidemann 2021-03-08 20:29:08 +01:00
parent 5f1b56f30b
commit f9826e28a5
44 changed files with 590 additions and 387 deletions

View File

@ -22,9 +22,50 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved spinner">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Added argument handling to spinner">
<change afterPath="$PROJECT_DIR$/docs/project_structure.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/__main__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/build_settings.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/build_settings_name.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/version_settings_name.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/templates/publish/setup.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/cli.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/cli.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/install.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/install.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/structure.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/structure.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/todo.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/todo.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/publish_templates/all_template.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/requirements.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl.json" beforeDir="false" afterPath="$PROJECT_DIR$/cpl.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/application/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/configuration/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/configuration/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/console/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/console/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/database/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/database/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/database/connection/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/database/connection/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/database/context/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/database/context/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/dependency_injection/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/dependency_injection/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/environment/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/environment/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/logging/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/logging/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/mailing/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/mailing/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/time/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/time/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/utils/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/utils/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/version/__init__.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/version/version.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/version.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/version/version_enum.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/cli.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/command/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/command/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/command/publish.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/command/publish.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/publish/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/publish/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/publish/project_settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/project_settings.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/publish/project_settings_name.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/configuration/project_settings_name.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/publish/publisher.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/publish/publisher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/startup.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/startup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/db/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/db/__init__.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -74,29 +115,29 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../sh_python_line_counter" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="editing.templates" />
</component>
<component name="ReaderModeSettings">
<option name="enabled" value="false" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/src/cpl_cli" />
<recent name="$PROJECT_DIR$/src_old" />
<recent name="$PROJECT_DIR$/src/cpl/dependency_injection" />
<recent name="$PROJECT_DIR$/src/cpl/application" />
<recent name="$PROJECT_DIR$/src/cpl/common/application" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/cpl_cli/configuration" />
<recent name="$PROJECT_DIR$/src/cpl_cli" />
<recent name="$PROJECT_DIR$/src/cpl" />
<recent name="$PROJECT_DIR$/src/cpl/database/connection" />
<recent name="$PROJECT_DIR$/src/cpl/database/context" />
<recent name="$PROJECT_DIR$/src/cpl/database" />
</key>
</component>
<component name="RunManager" selected="Python.cli build">
<component name="RunManager" selected="Python.cli publish">
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -105,11 +146,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/main.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="build" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -126,11 +167,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="db mig add InitialMigration" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -147,11 +188,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="database update" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -168,11 +209,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/main.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="help" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -189,11 +230,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new app ./Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -210,11 +251,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new app ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -231,11 +272,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new class ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -252,11 +293,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new configmodel ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -273,11 +314,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new enum ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -294,11 +335,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="new service ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -315,11 +356,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="publish" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -336,11 +377,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/main.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="version" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
@ -349,27 +390,6 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main cli" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -378,11 +398,11 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/cpl_cli" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/main.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/cpl_cli/__main__.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
@ -463,7 +483,6 @@
<item itemvalue="Python.cli new service" />
<item itemvalue="Python.cli publish" />
<item itemvalue="Python.cli version" />
<item itemvalue="Python.cli" />
<item itemvalue="Python.main" />
<item itemvalue="Python.main cli" />
<item itemvalue="Python tests.Unittests" />
@ -485,41 +504,6 @@
<option name="presentableId" value="Default" />
<updated>1605881914521</updated>
</task>
<task id="LOCAL-00048" summary="Added version command to cli">
<created>1608125743068</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1608125743068</updated>
</task>
<task id="LOCAL-00049" summary="Improved version command &amp; improved help command">
<created>1608127752645</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1608127752645</updated>
</task>
<task id="LOCAL-00050" summary="Improved cli error handling">
<created>1608127998033</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1608127998034</updated>
</task>
<task id="LOCAL-00051" summary="Removed module template">
<created>1608128026922</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1608128026922</updated>
</task>
<task id="LOCAL-00052" summary="Added build command to cli">
<created>1608133651981</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1608133651982</updated>
</task>
<task id="LOCAL-00053" summary="Improved publish process">
<created>1608136663213</created>
<option name="number" value="00053" />
@ -828,7 +812,42 @@
<option name="project" value="LOCAL" />
<updated>1614958058304</updated>
</task>
<option name="localTasksCounter" value="97" />
<task id="LOCAL-00097" summary="Improved publisher">
<created>1614958287131</created>
<option name="number" value="00097" />
<option name="presentableId" value="LOCAL-00097" />
<option name="project" value="LOCAL" />
<updated>1614958287131</updated>
</task>
<task id="LOCAL-00098" summary="Bugfix">
<created>1614959039041</created>
<option name="number" value="00098" />
<option name="presentableId" value="LOCAL-00098" />
<option name="project" value="LOCAL" />
<updated>1614959039041</updated>
</task>
<task id="LOCAL-00099" summary="Bugfix">
<created>1614959606937</created>
<option name="number" value="00099" />
<option name="presentableId" value="LOCAL-00099" />
<option name="project" value="LOCAL" />
<updated>1614959606937</updated>
</task>
<task id="LOCAL-00100" summary="Fixed output when console is spinning">
<created>1614960552294</created>
<option name="number" value="00100" />
<option name="presentableId" value="LOCAL-00100" />
<option name="project" value="LOCAL" />
<updated>1614960552294</updated>
</task>
<task id="LOCAL-00101" summary="Added argument handling to spinner">
<created>1614960859459</created>
<option name="number" value="00101" />
<option name="presentableId" value="LOCAL-00101" />
<option name="project" value="LOCAL" />
<updated>1614960859459</updated>
</task>
<option name="localTasksCounter" value="102" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -844,10 +863,6 @@
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Added more development tests" />
<MESSAGE value="Added new tester and CredentialManager TestCase" />
<MESSAGE value="Bugfix" />
<MESSAGE value="Added TimeFormatSettings Test" />
<MESSAGE value="Bugfixes" />
<MESSAGE value="Improved tests" />
<MESSAGE value="Bugfixes and improved tests" />
@ -869,7 +884,11 @@
<MESSAGE value="Improved workspace" />
<MESSAGE value="Added spinner" />
<MESSAGE value="Improved spinner" />
<option name="LAST_COMMIT_MESSAGE" value="Improved spinner" />
<MESSAGE value="Improved publisher" />
<MESSAGE value="Bugfix" />
<MESSAGE value="Fixed output when console is spinning" />
<MESSAGE value="Added argument handling to spinner" />
<option name="LAST_COMMIT_MESSAGE" value="Added argument handling to spinner" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

43
cpl.json Normal file
View File

@ -0,0 +1,43 @@
{
"ProjectSettings": {
"name": "sh_cpl",
"version": {
"major": "2021",
"minor": "04",
"micro": "01"
},
"author": "Sven Heidemann",
"authorEmail": "sven.heidemann@sh-edraft.de",
"description": "sh-edraft Common Python library",
"longDescription": "sh-edraft Common Python library",
"url": "https://www.sh-edraft.de",
"copyrightDate": "2020",
"copyrightName": "sh-edraft.de",
"licenseName": "MIT",
"licenseDescription": "MIT, see LICENSE for more details.",
"dependencies": [
"discord.py",
"mysql-connector",
"SQLAlchemy",
"termcolor",
"pyfiglet",
"tabulate",
"smtplib"
],
"pythonVersion": ">=3.8"
},
"BuildSettings": {
"sourcePath": "src/cpl",
"outputPath": "dist",
"main": "cpl_cli.main",
"entryPoint": "cpl",
"includePackageData": "False",
"included": [
"src/cpl_cli"
],
"excluded": [
"*/__pycache__",
"*/logs"
]
}
}

View File

@ -0,0 +1,5 @@
/src/
/.gitignore
/cpl.json
/LICENSE
/README.md

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
$Name $Description
~~~~~~~~~~~~~~~~~~~
$LongDescription
:copyright: (c) $CopyrightDate $CopyrightName
:license: $LicenseName$LicenseDescription
"""
__title__ = '$Title'
__author__ = '$Author'
__license__ = '$LicenseName'
__copyright__ = 'Copyright (c) $CopyrightDate $CopyrightName'
__version__ = '$Version'
from collections import namedtuple
$Imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=$Major, minor=$Minor, micro=$Micro)

View File

@ -1,29 +0,0 @@
aiohttp
async-timeout
attrs
certifi
chardet
click
dateutils
discord
discord.py
Flask
idna
itsdangerous
Jinja2
keyboard
MarkupSafe
multidict
mysql-connector
overloading
python-dateutil
pytz
six
SQLAlchemy
termcolor
urllib3
Werkzeug
yarl
setuptools
pyfiglet
tabulate

View File

@ -1,26 +0,0 @@
{
"ProjectSettings": {
"Name": "sh_cpl",
"Author": "Sven Heidemann",
"Description": "Common Python Library",
"LongDescription": "Common Python Library",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Version": {
"Major": "2021",
"Minor": "04",
"Micro": "01"
},
"SourcePath": "./cpl",
"DistPath": "../dist",
"Included": [
"./cpl_cli"
],
"Excluded": [
"__pycache__",
"logs"
]
}
}

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'sh_cpl.cpl'
__title__ = 'src.cpl'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.application'
__title__ = 'src.cpl.application'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.configuration'
__title__ = 'src.cpl.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.console'
__title__ = 'src.cpl.console'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.database'
__title__ = 'src.cpl.database'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.database.connection'
__title__ = 'src.cpl.database.connection'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.database.context'
__title__ = 'src.cpl.database.context'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.dependency_injection'
__title__ = 'src.cpl.dependency_injection'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.environment'
__title__ = 'src.cpl.environment'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.logging'
__title__ = 'src.cpl.logging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.mailing'
__title__ = 'src.cpl.mailing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.time'
__title__ = 'src.cpl.time'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.utils'
__title__ = 'src.cpl.utils'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,8 +0,0 @@
from enum import Enum
class VersionEnum(Enum):
Major = 'Major'
Minor = 'Minor'
Micro = 'Micro'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'sh_cpl.cpl_cli'
__title__ = 'src.cpl_cli'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

4
src/cpl_cli/__main__.py Normal file
View File

@ -0,0 +1,4 @@
from cpl_cli.main import main
if __name__ == '__main__':
main()

View File

@ -2,6 +2,7 @@ from typing import Optional
from cpl.application.application_abc import ApplicationABC
from cpl_cli.command.build import Build
from cpl_cli.command.publish import Publish
from cpl_cli.command_handler import CommandHandler
from cpl_cli.command_model import CommandModel
from cpl_cli.error import Error
@ -21,6 +22,7 @@ class CLI(ApplicationABC):
self._command_handler.add_command(CommandModel('build', ['h', 'B'], Build))
self._command_handler.add_command(CommandModel('help', ['h', 'H'], Help))
self._command_handler.add_command(CommandModel('publish', ['p', 'P'], Publish))
self._command_handler.add_command(CommandModel('version', ['v', 'V'], Version))
def main(self):

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.command'
__title__ = 'src.cpl_cli.command'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -0,0 +1,13 @@
from cpl_cli.command_abc import CommandABC
from cpl_cli.publish.publisher_abc import PublisherABC
class Publish(CommandABC):
def __init__(self, publisher: PublisherABC):
CommandABC.__init__(self)
self._publisher = publisher
def run(self, args: list[str]):
self._publisher.publish()

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl.version'
__title__ = 'src.cpl_cli.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -0,0 +1,65 @@
import traceback
from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.console.foreground_color import ForegroundColor
from cpl_cli.configuration.build_settings_name import BuildSettingsName
class BuildSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._source_path: Optional[str] = None
self._output_path: Optional[str] = None
self._main: Optional[str] = None
self._entry_point: Optional[str] = None
self._include_package_data: Optional[bool] = None
self._included: Optional[list[str]] = None
self._excluded: Optional[list[str]] = None
@property
def source_path(self) -> str:
return self._source_path
@property
def output_path(self) -> str:
return self._output_path
@property
def main(self) -> str:
return self._main
@property
def entry_point(self) -> str:
return self._entry_point
@property
def include_package_data(self) -> bool:
return self._include_package_data
@property
def included(self) -> list[str]:
return self._included
@property
def excluded(self) -> list[str]:
return self._excluded
def from_dict(self, settings: dict):
try:
self._source_path = settings[BuildSettingsName.sourcePath.value]
self._output_path = settings[BuildSettingsName.outputPath.value]
self._include_package_data = bool(settings[BuildSettingsName.include_package_data.value])
self._main = settings[BuildSettingsName.main.value]
self._entry_point = settings[BuildSettingsName.entry_point.value]
self._included = settings[BuildSettingsName.included.value]
self._excluded = settings[BuildSettingsName.excluded.value]
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(
f'[ ERROR ] [ {__name__} ]: Reading error in {BuildSettings.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColor.default)

View File

@ -0,0 +1,12 @@
from enum import Enum
class BuildSettingsName(Enum):
sourcePath = 'sourcePath'
outputPath = 'outputPath'
main = 'main'
entry_point = 'entryPoint'
include_package_data = 'includePackageData'
included = 'included'
excluded = 'excluded'

View File

@ -4,8 +4,8 @@ from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.console.console import Console
from cpl.console.foreground_color import ForegroundColor
from cpl.version.version import Version
from cpl_cli.publish.project_settings_name import ProjectSettingsName
from cpl_cli.configuration.version import Version
from cpl_cli.configuration.project_settings_name import ProjectSettingsName
class ProjectSettings(ConfigurationModelABC):
@ -14,97 +14,89 @@ class ProjectSettings(ConfigurationModelABC):
ConfigurationModelABC.__init__(self)
self._name: Optional[str] = None
self._version: Optional[Version] = Version()
self._author: Optional[str] = None
self._author_email: Optional[str] = None
self._description: Optional[str] = None
self._long_description: Optional[str] = None
self._url: Optional[str] = None
self._copyright_date: Optional[str] = None
self._copyright_name: Optional[str] = None
self._license_name: Optional[str] = None
self._license_description: Optional[str] = None
self._version: Optional[Version] = Version()
self._source_path: Optional[str] = None
self._dist_path: Optional[str] = None
self._included: list[str] = []
self._excluded: list[str] = []
self._dependencies: Optional[list[str]] = None
self._python_version: Optional[str] = None
@property
def name(self) -> Optional[str]:
def name(self):
return self._name
@property
def author(self) -> Optional[str]:
return self._author
@property
def description(self) -> Optional[str]:
return self._description
@property
def long_description(self) -> Optional[str]:
return self._long_description
@property
def copyright_date(self) -> Optional[str]:
return self._copyright_date
@property
def copyright_name(self) -> Optional[str]:
return self._copyright_name
@property
def license_name(self) -> Optional[str]:
return self._license_name
@property
def license_description(self) -> Optional[str]:
return self._license_description
@property
def version(self) -> Optional[Version]:
def version(self) -> Version:
return self._version
@property
def source_path(self) -> str:
return self._source_path
@source_path.setter
def source_path(self, source_path: str):
self._source_path = source_path
def author(self) -> str:
return self._author
@property
def dist_path(self) -> str:
return self._dist_path
@dist_path.setter
def dist_path(self, dist_path: str):
self._dist_path = dist_path
def author_email(self) -> str:
return self._author_email
@property
def included(self) -> list[str]:
return self._included
def description(self) -> str:
return self._description
@property
def excluded(self) -> list[str]:
return self._excluded
def long_description(self) -> str:
return self._long_description
@property
def url(self) -> str:
return self._url
@property
def copyright_date(self) -> str:
return self._copyright_date
@property
def copyright_name(self) -> str:
return self._copyright_name
@property
def license_name(self) -> str:
return self._license_name
@property
def license_description(self) -> str:
return self._license_description
@property
def dependencies(self) -> list[str]:
return self._dependencies
@property
def python_version(self) -> str:
return self._python_version
def from_dict(self, settings: dict):
try:
self._name = settings[ProjectSettingsName.name.value]
self._version.from_dict(settings[ProjectSettingsName.version.value])
self._author = settings[ProjectSettingsName.author.value]
self._author_email = settings[ProjectSettingsName.author_email.value]
self._description = settings[ProjectSettingsName.description.value]
self._long_description = settings[ProjectSettingsName.long_description.value]
self._url = settings[ProjectSettingsName.url.value]
self._copyright_date = settings[ProjectSettingsName.copyright_date.value]
self._copyright_name = settings[ProjectSettingsName.copyright_name.value]
self._license_name = settings[ProjectSettingsName.license_name.value]
self._license_description = settings[ProjectSettingsName.license_description.value]
self._version.from_dict(settings[ProjectSettingsName.version.value])
self._source_path = settings[ProjectSettingsName.source_path.value]
self._dist_path = settings[ProjectSettingsName.dist_path.value]
self._included = settings[ProjectSettingsName.included.value]
self._excluded = settings[ProjectSettingsName.excluded.value]
self._dependencies = settings[ProjectSettingsName.dependencies.value]
self._python_version = settings[ProjectSettingsName.python_version.value]
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(
f'[ ERROR ] [ {__name__} ]: Reading error in {ProjectSettingsName.project.value} settings')
f'[ ERROR ] [ {__name__} ]: Reading error in {ProjectSettings.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColor.default)

View File

@ -0,0 +1,18 @@
from enum import Enum
class ProjectSettingsName(Enum):
name = 'name'
version = 'version'
author = 'author'
author_email = 'authorEmail'
description = 'description'
long_description = 'longDescription'
url = 'url'
copyright_date = 'copyrightDate'
copyright_name = 'copyrightName'
license_name = 'licenseName'
license_description = 'licenseDescription'
dependencies = 'dependencies'
python_version = 'pythonVersion'

View File

@ -1,7 +1,7 @@
from typing import Optional
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.version.version_enum import VersionEnum
from cpl_cli.configuration.version_settings_name import VersionSettingsName
class Version(ConfigurationModelABC):
@ -34,13 +34,13 @@ class Version(ConfigurationModelABC):
return f'{self._major}.{self._minor}.{self._micro}'
def from_dict(self, settings: dict):
self._major = int(settings[VersionEnum.Major.value])
self._minor = int(settings[VersionEnum.Minor.value])
self._micro = int(settings[VersionEnum.Micro.value])
self._major = int(settings[VersionSettingsName.major.value])
self._minor = int(settings[VersionSettingsName.minor.value])
self._micro = int(settings[VersionSettingsName.micro.value])
def to_dict(self) -> dict:
return {
VersionEnum.Major.value: self._major,
VersionEnum.Minor.value: self._minor,
VersionEnum.Micro.value: self._micro
VersionSettingsName.major.value: self._major,
VersionSettingsName.minor.value: self._minor,
VersionSettingsName.micro.value: self._micro
}

View File

@ -0,0 +1,8 @@
from enum import Enum
class VersionSettingsName(Enum):
major = 'major'
minor = 'minor'
micro = 'micro'

View File

@ -1,7 +1,8 @@
from cpl_cli.cli import CLI
from cpl_cli.startup import Startup
if __name__ == '__main__':
def main():
cli = CLI()
cli.use_startup(Startup)
cli.build()

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl Common Python Library
sh_cpl sh-edraft Common Python library
~~~~~~~~~~~~~~~~~~~
Common Python Library
sh-edraft Common Python library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
:license: MITMIT, see LICENSE for more details.
"""
__title__ = 'cpl_cli.publish'
__title__ = 'src.cpl_cli.publish'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,19 +0,0 @@
from enum import Enum
class ProjectSettingsName(Enum):
project = 'Project'
name = 'Name'
author = 'Author'
description = 'Description'
long_description = 'LongDescription'
copyright_date = 'CopyrightDate'
copyright_name = 'CopyrightName'
license_name = 'LicenseName'
license_description = 'LicenseDescription'
version = 'Version'
source_path = 'SourcePath'
dist_path = 'DistPath'
included = 'Included'
excluded = 'Excluded'

View File

@ -1,25 +1,32 @@
import importlib
import os
import shutil
import time
from string import Template as stringTemplate
import setuptools
from setuptools import sandbox
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
from cpl.console.console import Console
from cpl_cli.publish.project_settings import ProjectSettings
from cpl_cli.configuration.build_settings import BuildSettings
from cpl_cli.configuration.project_settings import ProjectSettings
from cpl_cli.publish.publisher_abc import PublisherABC
class Publisher(PublisherABC):
def __init__(self, runtime: ApplicationRuntimeABC, project: ProjectSettings):
def __init__(self, runtime: ApplicationRuntimeABC, project: ProjectSettings, build: BuildSettings):
PublisherABC.__init__(self)
self._runtime = runtime
self._project = project
self._project.source_path = os.path.join(self._runtime.working_directory, self._project.source_path)
self._project.dist_path = os.path.join(self._runtime.working_directory, self._project.dist_path)
self._project_settings = project
self._build_settings = build
self._source_path = os.path.join(self._runtime.working_directory, self._build_settings.source_path)
self._output_path = os.path.join(self._runtime.working_directory, self._build_settings.output_path)
self._included_files: list[str] = []
self._distributed_files: list[str] = []
@property
def source_path(self) -> str:
@ -59,9 +66,18 @@ class Publisher(PublisherABC):
Console.error(f'{e}')
exit()
def _is_path_excluded(self, path: str) -> bool:
for excluded in self._build_settings.excluded:
if excluded.startswith('*'):
excluded = excluded.replace('*', '')
if excluded in path:
return True
return False
def _read_sources(self):
time.sleep(2)
for file in self._project.included:
for file in self._build_settings.included:
rel_path = os.path.relpath(file)
if os.path.isdir(rel_path):
for r, d, f in os.walk(rel_path):
@ -69,15 +85,7 @@ class Publisher(PublisherABC):
relative_path = os.path.relpath(r)
file_path = os.path.join(relative_path, os.path.relpath(sub_file))
is_excluded = False
for excluded in self._project.excluded:
if excluded in relative_path:
is_excluded = True
if relative_path in excluded:
is_excluded = True
if not is_excluded:
if not self._is_path_excluded(relative_path):
self._included_files.append(os.path.relpath(file_path))
elif os.path.isfile(rel_path):
@ -86,12 +94,12 @@ class Publisher(PublisherABC):
else:
Console.error(f'Path not found: {rel_path}')
for r, d, f in os.walk(self._project.source_path):
for r, d, f in os.walk(self._build_settings.source_path):
for file in f:
relative_path = os.path.relpath(r)
file_path = os.path.join(relative_path, os.path.relpath(file))
if relative_path not in self._project.excluded:
if not self._is_path_excluded(relative_path):
self._included_files.append(os.path.relpath(file_path))
def _create_packages(self):
@ -102,9 +110,9 @@ class Publisher(PublisherABC):
title = self._get_module_name_from_dirs(file)
if title == '':
title = self._project.name
title = self._project_settings.name
elif not title.__contains__('.'):
title = f'{self._project.name}.{title}'
title = f'{self._project_settings.name}.{title}'
module_py_lines: list[str] = []
imports = ''
@ -129,19 +137,19 @@ class Publisher(PublisherABC):
with open(os.path.join(self._runtime.runtime_directory, 'templates/build/init.txt'), 'r') as template:
template_content = stringTemplate(template.read()).substitute(
Name=self._project.name,
Description=self._project.description,
LongDescription=self._project.long_description,
CopyrightDate=self._project.copyright_date,
CopyrightName=self._project.copyright_name,
LicenseName=self._project.license_name,
LicenseDescription=self._project.license_description,
Title=title if title is not None and title != '' else self._project.name,
Author=self._project.author,
Version=self._project.version.to_str(),
Major=self._project.version.major,
Minor=self._project.version.minor,
Micro=self._project.version.micro,
Name=self._project_settings.name,
Description=self._project_settings.description,
LongDescription=self._project_settings.long_description,
CopyrightDate=self._project_settings.copyright_date,
CopyrightName=self._project_settings.copyright_name,
LicenseName=self._project_settings.license_name,
LicenseDescription=self._project_settings.license_description,
Title=title if title is not None and title != '' else self._project_settings.name,
Author=self._project_settings.author,
Version=self._project_settings.version.to_str(),
Major=self._project_settings.version.major,
Minor=self._project_settings.version.minor,
Micro=self._project_settings.version.micro,
Imports=imports
)
@ -150,36 +158,132 @@ class Publisher(PublisherABC):
py_file.close()
def _dist_files(self):
build_path = os.path.join(self._project.dist_path, 'build')
build_path = os.path.join(self._output_path)
self._delete_path(build_path)
self._create_path(build_path)
for file in self._included_files:
output_path = os.path.join(build_path, os.path.dirname(file))
output_file = os.path.join(build_path, file)
dist_file = file
if 'src/' in dist_file:
dist_file = dist_file.replace('src/', '')
output_path = os.path.join(build_path, os.path.dirname(dist_file))
output_file = os.path.join(build_path, dist_file)
try:
if not os.path.isdir(output_path):
os.makedirs(output_path, exist_ok=True)
except Exception as e:
Console.error(__name__, f'Cannot create directories: {output_path} -> {e}')
return
try:
self._distributed_files.append(output_file)
shutil.copy(os.path.abspath(file), output_file)
except Exception as e:
Console.error(__name__, f'Cannot copy file: {file} to {output_path} -> {e}')
return
def _clean_dist_files(self):
paths: list[str] = []
for file in self._distributed_files:
paths.append(os.path.dirname(file))
if os.path.isfile(file):
os.remove(file)
for path in paths:
if os.path.isdir(path):
shutil.rmtree(path)
def _create_setup(self):
setup_file = os.path.join(self._output_path, 'setup.py')
if os.path.isfile(setup_file):
os.remove(setup_file)
template_path = os.path.join(self._runtime.runtime_directory, 'templates/publish/setup.txt')
if not os.path.isfile(template_path):
Console.error(__name__, f'setup.py template not found in {template_path}')
return
template_string = ''
with open(template_path, 'r') as template_file:
template_string = template_file.read()
template_file.close()
main = None
try:
main = importlib.import_module(self._build_settings.main)
except Exception as e:
Console.error('Could not find entry point', str(e))
if main is None:
Console.error('Could not find entry point')
return
with open(setup_file, 'w+') as setup_py:
setup_string = stringTemplate(template_string).substitute(
Name=self._project_settings.name,
Version=self._project_settings.version.to_str(),
Packages=setuptools.find_packages(where=self._build_settings.source_path, exclude=self._build_settings.excluded),
URL=self._project_settings.url,
LicenseName=self._project_settings.license_name,
Author=self._project_settings.author,
AuthorMail=self._project_settings.author_email,
InstallPackageData=self._build_settings.include_package_data,
Description=self._project_settings.description,
PyRequires=self._project_settings.python_version,
Dependencies=self._project_settings.dependencies,
EntryPoints={
'console_scripts': [
f'{self._build_settings.entry_point} = {main.__name__}:{main.main.__name__}'
]
}
)
setup_py.write(setup_string)
setup_py.close()
def _run_setup(self):
setup_py = os.path.join(self._output_path, 'setup.py')
if not os.path.isfile(setup_py):
Console.error(__name__, f'setup.py not found in {self._output_path}')
return
try:
sandbox.run_setup(os.path.abspath(setup_py), [
'sdist',
f'--dist-dir={os.path.join(self._output_path, "setup")}',
'bdist_wheel',
f'--bdist-dir={os.path.join(self._output_path, "bdist")}',
f'--dist-dir={os.path.join(self._output_path, "setup")}'
])
os.remove(setup_py)
except Exception as e:
Console.error('Executing setup.py failed', str(e))
def include(self, path: str):
self._project.included.append(path)
self._build_settings.included.append(path)
def exclude(self, path: str):
self._project.excluded.append(path)
self._build_settings.excluded.append(path)
def build(self):
self._output_path = os.path.join(self._output_path, 'build')
Console.spinner('Reading source files:', self._read_sources)
Console.spinner('Creating internal packages:', self._create_packages)
Console.write_line('Building application:')
self._dist_files()
Console.spinner('Building application:', self._dist_files)
def publish(self):
pass
self._output_path = os.path.join(self._output_path, 'publish')
Console.write_line('Build:')
Console.spinner('Reading source files:', self._read_sources)
Console.spinner('Creating internal packages:', self._create_packages)
Console.spinner('Building application:', self._dist_files)
Console.write_line('\nPublish:')
Console.spinner('Generating setup.py:', self._create_setup)
Console.write_line('Running setup.py:\n')
self._run_setup()
Console.spinner('Cleaning dist path:', self._clean_dist_files)

View File

@ -6,6 +6,7 @@ from cpl.application.startup_abc import StartupABC
from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.dependency_injection.service_provider_base import ServiceProviderABC
from cpl_cli.command.build import Build
from cpl_cli.command.publish import Publish
from cpl_cli.command_handler import CommandHandler
from cpl_cli.command.help import Help
from cpl_cli.command.version import Version
@ -40,6 +41,7 @@ class Startup(StartupABC):
self._configuration.add_json_file('cpl.json', optional=True, output=False)
self._configuration.add_console_argument('', 'build', ['-b', '-B'], '')
self._configuration.add_console_argument('', 'help', ['-h', '-H'], '')
self._configuration.add_console_argument('', 'publish', ['-p', '-P'], '')
self._configuration.add_console_argument('', 'version', ['-v', '-V'], '')
self._configuration.add_console_arguments()
@ -52,6 +54,7 @@ class Startup(StartupABC):
self._services.add_transient(Build)
self._services.add_transient(Help)
self._services.add_transient(Publish)
self._services.add_transient(Version)
return self._services

View File

@ -0,0 +1,21 @@
"""
This file is generated by CPL CLI
"""
import setuptools
setuptools.setup(
name='$Name',
version='$Version',
packages=$Packages,
url='$URL',
license='$LicenseName',
author='$Author',
author_email='$AuthorMail',
include_package_data=$InstallPackageData,
description='$Description',
package_dir = {'': 'cpl'},
python_requires='$PyRequires',
install_requires=$Dependencies,
entry_points=$EntryPoints
)

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl.tests Common Python Library CLI
sh_cpl Common Python Library
~~~~~~~~~~~~~~~~~~~
Common Python Library CLI
Common Python Library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_cpl.tests'
__title__ = 'src.tests'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""
sh_cpl.tests Common Python Library CLI
sh_cpl Common Python Library
~~~~~~~~~~~~~~~~~~~
Common Python Library CLI
Common Python Library
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_cpl.tests.db'
__title__ = 'src.tests.db'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'