From 3f33035611f6eb5f146880e02ca2d957b3b0a7a5 Mon Sep 17 00:00:00 2001 From: mdnapo Date: Thu, 25 Jul 2024 07:34:15 +0200 Subject: [PATCH] Cleaned up --- MycroForge.CLI/scripts/build-executable.sh | 11 ------- MycroForge.CLI/scripts/build-executables.sh | 7 ---- MycroForge.CLI/scripts/install.sh | 21 ------------ MycroForge.CLI/scripts/install2.sh | 19 ----------- MycroForge.CLI/scripts/publish-linux.sh | 11 ------- .../{publish-dotnet.sh => publish-tool.sh} | 0 README.md | 32 +------------------ docs/docs/command_plugins.md | 2 +- docs/docs/getting_started.md | 28 ++++++++++------ 9 files changed, 21 insertions(+), 110 deletions(-) delete mode 100644 MycroForge.CLI/scripts/build-executable.sh delete mode 100644 MycroForge.CLI/scripts/build-executables.sh delete mode 100644 MycroForge.CLI/scripts/install.sh delete mode 100644 MycroForge.CLI/scripts/install2.sh delete mode 100644 MycroForge.CLI/scripts/publish-linux.sh rename MycroForge.CLI/scripts/{publish-dotnet.sh => publish-tool.sh} (100%) diff --git a/MycroForge.CLI/scripts/build-executable.sh b/MycroForge.CLI/scripts/build-executable.sh deleted file mode 100644 index 7fc3fe6..0000000 --- a/MycroForge.CLI/scripts/build-executable.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/bash - -TARGET=$1 - -if [ -z "$TARGET" ]; then - echo "The target platform was not provided." - exit 1 -fi - -dotnet publish --self-contained -r "$TARGET" -zip -vr "releases/m4g-$TARGET.zip" "bin/Release/net8.0/$TARGET/" diff --git a/MycroForge.CLI/scripts/build-executables.sh b/MycroForge.CLI/scripts/build-executables.sh deleted file mode 100644 index 7a3cc3f..0000000 --- a/MycroForge.CLI/scripts/build-executables.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/bash - -./scripts/build-executable.sh linux-x64 -./scripts/build-executable.sh linux-arm -./scripts/build-executable.sh linux-arm64 -./scripts/build-executable.sh osx-x64 -./scripts/build-executable.sh osx-arm64 diff --git a/MycroForge.CLI/scripts/install.sh b/MycroForge.CLI/scripts/install.sh deleted file mode 100644 index 82689c0..0000000 --- a/MycroForge.CLI/scripts/install.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/bash - -ZIP=$1 -if [ -z "$ZIP" ]; then - echo "The zip file was not provided." - exit 1 -fi - -TARGET=${ZIP//"m4g-"/} -TARGET=${TARGET//".zip"/} - -DIR="/tmp/m4g" - -rm -rf "$DIR" -unzip "$ZIP" -d "$DIR" - -sudo rm -rf /usr/share/m4g -sudo cp -r "$DIR/bin/Release/net8.0/$TARGET" /usr/share/m4g - -sudo unlink /usr/local/bin/m4g 2> /dev/null -sudo ln -s /usr/share/m4g/MycroForge.CLI /usr/local/bin/m4g diff --git a/MycroForge.CLI/scripts/install2.sh b/MycroForge.CLI/scripts/install2.sh deleted file mode 100644 index 9d8dadd..0000000 --- a/MycroForge.CLI/scripts/install2.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/bash - -ZIP=$1 -if [ -z "$ZIP" ]; then - echo "The zip file was not provided." - exit 1 -fi - -TARGET=${ZIP//"m4g-"/} -TARGET=${TARGET//".zip"/} - -DIR="/tmp/m4g" - -rm -rf "$DIR" -unzip "$ZIP" -d "$DIR" - -sudo rm -rf /usr/local/bin/m4g -sudo cp -r "$DIR/bin/Release/net8.0/$TARGET" /usr/local/bin/m4g -mv /usr/share/m4g/MycroForge.CLI /usr/share/m4g/m4g diff --git a/MycroForge.CLI/scripts/publish-linux.sh b/MycroForge.CLI/scripts/publish-linux.sh deleted file mode 100644 index ae2bad0..0000000 --- a/MycroForge.CLI/scripts/publish-linux.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/bash - -# Make sure to run this script from the MycroForge.CLI directory and prefixed with sudo! -# Example: -# sudo ./scripts/publish-linux.sh - -dotnet publish --self-contained -r linux-x64 -sudo rm -rf /usr/share/m4g -sudo cp -r bin/Release/net8.0/linux-x64 /usr/share/m4g -sudo unlink /usr/local/bin/m4g -sudo ln -s /usr/share/m4g/MycroForge.CLI /usr/local/bin/m4g diff --git a/MycroForge.CLI/scripts/publish-dotnet.sh b/MycroForge.CLI/scripts/publish-tool.sh similarity index 100% rename from MycroForge.CLI/scripts/publish-dotnet.sh rename to MycroForge.CLI/scripts/publish-tool.sh diff --git a/README.md b/README.md index 8503b76..27236ba 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,7 @@ -### Dependencies - -- git -- Docker -- bash (/bin/bash) -- Python 3.10.2 (/usr/bin/python3) - - python3-pip - - python3-venv - -#### Note -The MycroForge CLI assumes a linux compatible environment, so on Windows you'll have to use WSL. -`Ubuntu-22.04` is the recommended WSL version to use. - -### TODO -- Figure out why BashException cannot be caught, can it be due to the differences in scoping? - Because the `Bash` class is static and the services calling `Bash.ExecuteAsync` are in the container. - Maybe this in combination with the async nature of the whole thing? - -### Install - -Run the install script in the same directory as the downloaded zip. See the example below for linux-x64. - -`sudo ./install.sh m4g-.zip ` - -### Add DevDisciples NuGet source - -```bash -dotnet nuget add source --name devdisciples --username username --password password https://git.devdisciples.com/api/packages/devdisciples/nuget/index.json --store-password-in-clear-text -``` - ### TODO - Add a CLI UI library - Clean up README files - Theme the site with a custom color scheme and icon/logos -- Mention assumed knowledge of both FastAPI & SQLAlchemy - Elaborate on terminology and best practices, like meaningful service names (also emphasize common sense?) +- Fix bug in HelloWorldCommand.ExecuteAsync diff --git a/docs/docs/command_plugins.md b/docs/docs/command_plugins.md index 9c84dbf..9413f0a 100644 --- a/docs/docs/command_plugins.md +++ b/docs/docs/command_plugins.md @@ -42,7 +42,7 @@ My.Dotenv.Plugin ┗ 📜My.Dotenv.Plugin.csproj ``` -Rename the following files. Also rename the classes in these files, the easiest way in `vscode` is the right click the class name and select the `Rename symbol` action. Note that this action does not (necessarily) rename the files! +Rename the following files. Also rename the classes in these files, the easiest way in `vscode` is to right click the class name and select the `Rename symbol` action. Note that this action does not (necessarily) rename the files! ``` HelloWorldCommand.cs => DotenvCommand.cs diff --git a/docs/docs/getting_started.md b/docs/docs/getting_started.md index 9ca20e7..cfa2af0 100644 --- a/docs/docs/getting_started.md +++ b/docs/docs/getting_started.md @@ -8,12 +8,18 @@ sidebar_position: 2 To use MycroForge, ensure you have the following dependencies installed: -- **bash** -- **git** -- **Python 3.10** -- **Docker** -- **.NET 8** -- **XCode Command Line Tools (MacOS only)** +- [**bash**](https://www.gnu.org/software/bash/) +- [**git**](https://git-scm.com/) +- [**Python 3.10**](https://www.python.org/downloads/release/python-3100/) +- [**Docker**](https://www.docker.com/) +- [**.NET 8**](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) +- [**XCode Command Line Tools (MacOS only)**](https://mac.install.guide/commandlinetools/) + +## Prior knowledge + +Since this tool is meant to generate FastAPI & SQLAlchemy code, you should have decent knowledge of both frameworks. If not, then please follow the links below to learn more about them. +- [FastAPI](https://fastapi.tiangolo.com/) +- [SQLAlchemy](https://www.sqlalchemy.org/) ### Adding the Package Registry @@ -61,8 +67,12 @@ You can only add it to the current session by running the following command: export PATH="$PATH:/Users/username/.dotnet/tools" ``` -#### Known issues +### Known issues -##### FastAPI swagger blank screen +#### FastAPI swagger blank screen (MacOS only) -If you see a blank screen when opening the FastAPI Swagger documentation, then make sure you've activated the Safari developer tools. \ No newline at end of file +If you see a blank screen when opening the FastAPI Swagger documentation, then make sure you've activated the Safari developer tools. + +#### Database container doesn't start after running `m4g db run` + +If the database, i.e. the mariadb container, doesn't successfully start after running `m4g db run` the first time, then try running it again. This often works, but yeah...it's hacky. However, at the time of writing it's unknown what causes this.