]> juplo.de Git - demos/kafka/training/commitdiff
COPY.sh → copy.sh: vollständig überarbeitet
authorKai Moritz <kai.milan.moritz@googlemail.com>
Fri, 29 May 2026 23:58:36 +0000 (23:58 +0000)
committerKai Moritz <kai.milan.moritz@googlemail.com>
Fri, 29 May 2026 23:58:36 +0000 (23:58 +0000)
- Script-Excludes auf neue Kleinbuchstaben-Namen aktualisiert
- .gitignore nicht mehr ausgeschlossen (Teilnehmer brauchen sie)
- gradle/wrapper/gradle-wrapper.jar explizit ausgeschlossen
- Sonderfall springkafka/technik-check → vorlagen/grundlagen/technik-check/
- --livecoding--schritte vor --livecoding geprüft (Pattern-Reihenfolge)
- Bash-String-Operationen statt sed für Suffix-Entfernung
- --nexus-url=<url> Parameter: ruft patch-nexus.sh auf die Vorlagen auf
- Parameterübergabe für Tag-Suffix und Optionen vereinheitlicht

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
COPY.sh [deleted file]
copy.sh [new file with mode: 0755]

diff --git a/COPY.sh b/COPY.sh
deleted file mode 100755 (executable)
index 04c5a42..0000000
--- a/COPY.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-set -e
-
-VORLAGEN=../vorlagen
-LIVECODING=../livecoding
-MUSTERLOESUNGEN=../spickzettel
-
-source BRANCHES.sh
-
-if [ "$1" != "" ];
-then
-  # Der erste Parameter wird als SUFFIX interpretiert
-  git checkout grundlagen/docker--${1}
-else
-  git checkout grundlagen/docker
-fi
-mkdir -p $VORLAGEN/grundlagen/docker/
-rsync -av --exclude=.git --exclude=target --exclude=.idea --exclude=.gradle --exclude=build --exclude=BRANCHES.sh --exclude=BUILD.sh --exclude=COPY.sh --exclude=DIFF.sh --exclude=.gitignore --exclude=PUSH.sh --exclude=REBASE.sh --exclude=RESET.sh --exclude=TAG.sh . $VORLAGEN/grundlagen/docker/
-
-for i in $BRANCHES;
-do
-  declare -n branch=${i}
-  if [ "$1" != "" ];
-  then
-    # Der erste Parameter wird als SUFFIX interpretiert
-    git checkout $branch--${1}
-  else
-    git checkout $branch
-  fi
-  case $branch in
-  *--vorlage)
-    vorlage=$(echo $branch |sed -e 's/--vorlage$//')
-    echo "Vorlage: $vorlage"
-    mkdir -p $VORLAGEN/$vorlage/
-    rsync -av --exclude=.git --exclude=target --exclude=.idea --exclude=.gradle --exclude=build --exclude=BRANCHES.sh --exclude=BUILD.sh --exclude=COPY.sh --exclude=DIFF.sh --exclude=.gitignore --exclude=PUSH.sh --exclude=REBASE.sh --exclude=RESET.sh --exclude=TAG.sh . $VORLAGEN/$vorlage/
-    ;;
-  *--livecoding)
-    livecoding=$(echo $branch |sed -e 's/--livecoding$//')
-    echo "Live-Coding: $livecoding"
-    mkdir -p $LIVECODING/$livecoding/
-    rsync -av --exclude=.git --exclude=target --exclude=.idea --exclude=.gradle --exclude=build --exclude=BRANCHES.sh --exclude=BUILD.sh --exclude=COPY.sh --exclude=DIFF.sh --exclude=.gitignore --exclude=PUSH.sh --exclude=REBASE.sh --exclude=RESET.sh --exclude=TAG.sh . $LIVECODING/$livecoding/
-    ;;
-  *--livecoding--schritte)
-    echo "Ignoriere die Einzelschritte eines Live-Coding: $livecoding"
-    ;;
-  *)
-    echo "Lösung: $branch"
-    mkdir -p $MUSTERLOESUNGEN/$branch/
-    rsync -av --exclude=.git --exclude=target --exclude=.idea --exclude=.gradle --exclude=build --exclude=BRANCHES.sh --exclude=BUILD.sh --exclude=COPY.sh --exclude=DIFF.sh --exclude=.gitignore --exclude=PUSH.sh --exclude=REBASE.sh --exclude=RESET.sh --exclude=TAG.sh . $MUSTERLOESUNGEN/$branch/
-    ;;
-  esac
-done
-
-git checkout scripting
diff --git a/copy.sh b/copy.sh
new file mode 100755 (executable)
index 0000000..6dc43b7
--- /dev/null
+++ b/copy.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+set -e
+
+VORLAGEN=../vorlagen
+LIVECODING=../livecoding
+MUSTERLOESUNGEN=../spickzettel
+
+source branches.sh
+
+# Optionaler Parameter: Tag-Suffix (kopiert dann den jeweiligen Tag-Stand statt den aktuellen Branch)
+# Optionaler Parameter: --nexus-url=<url> (ruft patch-nexus.sh auf die Vorlagen an)
+TAG_SUFFIX=""
+NEXUS_URL=""
+for arg in "$@"; do
+  case "$arg" in
+    --nexus-url=*) NEXUS_URL="${arg#--nexus-url=}" ;;
+    --*) echo "Unbekannter Parameter: $arg"; exit 1 ;;
+    *) TAG_SUFFIX="$arg" ;;
+  esac
+done
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+RSYNC_OPTS=(
+  rsync -av
+  --exclude=.git
+  --exclude=target
+  --exclude=.idea
+  --exclude=.gradle
+  --exclude=build
+  --exclude=gradle/wrapper/gradle-wrapper.jar
+  --exclude=branches.sh
+  --exclude=build.sh
+  --exclude=copy.sh
+  --exclude=diff.sh
+  --exclude=patch-nexus.sh
+  --exclude=push.sh
+  --exclude=reset.sh
+)
+
+sync_to() {
+  mkdir -p "$1"
+  "${RSYNC_OPTS[@]}" . "$1"
+}
+
+if [ "$TAG_SUFFIX" != "" ]; then
+  git checkout "grundlagen/docker--${TAG_SUFFIX}"
+else
+  git checkout grundlagen/docker
+fi
+sync_to "$VORLAGEN/grundlagen/docker/"
+
+for i in $BRANCHES; do
+  declare -n branch=${i}
+  if [ "$TAG_SUFFIX" != "" ]; then
+    git checkout "${branch}--${TAG_SUFFIX}"
+  else
+    git checkout "$branch"
+  fi
+  case "$branch" in
+  *--livecoding--schritte)
+    echo "Ignoriere Einzelschritte eines Live-Codings: $branch"
+    ;;
+  *--vorlage)
+    vorlage="${branch%--vorlage}"
+    # Sonderfall: technik-check gehört thematisch zu den Grundlagen
+    if [ "$vorlage" = "springkafka/technik-check" ]; then
+      sync_to "$VORLAGEN/grundlagen/technik-check/"
+    else
+      sync_to "$VORLAGEN/$vorlage/"
+    fi
+    ;;
+  *--livecoding)
+    livecoding="${branch%--livecoding}"
+    sync_to "$LIVECODING/$livecoding/"
+    ;;
+  *)
+    sync_to "$MUSTERLOESUNGEN/$branch/"
+    ;;
+  esac
+done
+
+if [ "$NEXUS_URL" != "" ]; then
+  echo -e "\nPatche Gradle-Setups für Nexus: $NEXUS_URL"
+  (cd "$VORLAGEN" && "$SCRIPT_DIR/patch-nexus.sh" "$NEXUS_URL")
+fi
+
+git checkout scripting