Files
ScadaBridge/tools/scrub-scadalink-refs.sh
T
Joseph Doherty c899cb162c refactor: scrub residual ScadaLink refs → ScadaBridge (env vars, config keys, assembly name, SQL login)
Renames the 13 SCADALINK_* runtime env vars → SCADABRIDGE_*, the ScadaLink__
.NET config keys → ScadaBridge__, the stale ScadaLink.Host.exe assembly name
→ ZB.MOM.WW.ScadaBridge.Host.exe, the scadalink_app SQL login → scadabridge_app,
and residual identifiers/comments/docs. Migration records (prior rename
tooling/design, DB-rename helper, this scrub script) carved out.

Adds tools/scrub-scadalink-refs.sh.
2026-05-31 21:50:38 -04:00

40 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# One-time scrub of residual ScadaLink/scadalink references → ScadaBridge.
# Operates on git-tracked TEXT files only (git grep -I skips binaries),
# minus carve-out migration records whose before→after meaning must survive.
# Substitutions are applied most-specific-first so a broad rule cannot
# double-replace an earlier result. Idempotent: re-running is a no-op.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
# Carve-outs (migration records): prior rename tooling/design, the DB-rename
# helper, this script itself, and the rename design + plan docs (which document
# the old→new mapping and would be self-corrupted by the substitution).
EXCLUDES_RE='^(tools/rename-to-scadabridge\.sh|tools/scrub-scadalink-refs\.sh|docker/rename-databases\.sh|docs/plans/2026-05-28-scadabridge-rename-design\.md|docs/plans/2026-05-31-folder-repo-rename-scadabridge-design\.md|docs/plans/2026-05-31-folder-repo-rename-scadabridge-plan\.md)$'
files=()
while IFS= read -r f; do
[[ "$f" =~ $EXCLUDES_RE ]] && continue
files+=("$f")
done < <(git grep -liI 'scadalink' -- .)
if [[ ${#files[@]} -eq 0 ]]; then
echo "No files to scrub."
exit 0
fi
printf 'Scrubbing %d file(s):\n' "${#files[@]}"
printf ' %s\n' "${files[@]}"
sed -i '' \
-e 's/ScadaLink\.Host\.exe/ZB.MOM.WW.ScadaBridge.Host.exe/g' \
-e 's/ScadaLink__/ScadaBridge__/g' \
-e 's/SCADALINK_/SCADABRIDGE_/g' \
-e 's/scadaLinkVersion/scadaBridgeVersion/g' \
-e 's/scadalink_app/scadabridge_app/g' \
-e 's/ScadaLink/ScadaBridge/g' \
-e 's/scadalink/scadabridge/g' \
"${files[@]}"
echo "Done."