Initial commit

This commit is contained in:
2026-02-01 16:51:56 +00:00
commit fb6a4df1bb
13 changed files with 590 additions and 0 deletions

109
ProjectConfigurator.sh Executable file
View File

@@ -0,0 +1,109 @@
#!/usr/bin/env bash
set -euo pipefail
# -----------------------------
# Intro
# -----------------------------
echo "Project Configurator"
echo "--------------------"
# -----------------------------
# Projektname abfragen
# -----------------------------
read -rp "What should the project be called? " PROJECT_NAME
if [[ -z "$PROJECT_NAME" ]]; then
echo "Project name cannot be empty."
exit 1
fi
if [[ ! "$PROJECT_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
echo "Invalid project name. Use only letters, numbers, _ or -"
exit 1
fi
# -----------------------------
# Ordner umbenennen
# -----------------------------
if [ ! -d "DemoProject" ]; then
echo "Placeholder directory 'DemoProject' not found."
exit 1
fi
echo "Renaming project directory..."
mv "DemoProject" "$PROJECT_NAME"
# -----------------------------
# CMakeLists.txt anpassen
# -----------------------------
if [ ! -f "CMakeLists.txt" ]; then
echo "CMakeLists.txt not found in root."
exit 1
fi
echo "Updating CMakeLists.txt..."
sed -i "s/DemoProject/$PROJECT_NAME/g" CMakeLists.txt
# -----------------------------
# globalVars.hpp anpassen
# -----------------------------
GLOBAL_VARS_PATH="$PROJECT_NAME/include/globalVars.hpp"
if [ ! -f "$GLOBAL_VARS_PATH" ]; then
echo "globalVars.hpp not found in root."
exit 1
fi
echo "Updating globalVars.hpp..."
sed -i "s/DemoProject/$PROJECT_NAME/g" "$GLOBAL_VARS_PATH"
# -----------------------------
# launch.json anpassen
# -----------------------------
GLOBAL_VARS_PATH=".vscode/launch.json"
if [ ! -f "$GLOBAL_VARS_PATH" ]; then
echo "globalVars.hpp not found in root."
exit 1
fi
echo "Updating globalVars.hpp..."
sed -i "s/DemoProject/$PROJECT_NAME/g" "$GLOBAL_VARS_PATH"
# -----------------------------
# Git Submodule aktualisieren
# -----------------------------
if [ -f ".gitmodules" ]; then
echo "Initializing and updating submodules..."
git submodule update --init --recursive
echo "Updating submodules to latest main branch..."
git submodule foreach '
git fetch origin &&
git checkout main &&
git pull origin main
'
else
echo "No submodules found. Skipping."
fi
# -----------------------------
# Git vorbereiten
# -----------------------------
echo "Preparing git repository..."
# falls das Repo aus Template kommt, existiert Git schon
git add .
git commit -m "Configure project $PROJECT_NAME"
# -----------------------------
# Ziel-Repository pushen
# -----------------------------
git push -u origin main
# -----------------------------
# Fertig
# -----------------------------
echo "Done."
echo "Project '$PROJECT_NAME' is ready."