Cleaned up

This commit is contained in:
mdnapo 2024-07-25 07:34:15 +02:00
parent 32b7a3c01c
commit 3f33035611
9 changed files with 21 additions and 110 deletions

View File

@ -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/"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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-<platform>.zip <platform>`
### 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

View File

@ -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

View File

@ -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.
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.