|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Rename the project's parent directory from Noema to Codifide. |
| 3 | +# |
| 4 | +# This script exists because the Codifide language codebase sits at |
| 5 | +# /Users/douglasjones/Projects/Noema — the parent directory still |
| 6 | +# carries the old name from before the rename. No file inside the |
| 7 | +# repository depends on that path (all imports and paths inside |
| 8 | +# the code are relative), so moving the directory is purely a |
| 9 | +# disk-layout change. |
| 10 | +# |
| 11 | +# Run this script from *outside* the project directory. It cannot |
| 12 | +# rename the directory it is executing inside. After the move, cd |
| 13 | +# into the new location and verify the test suite still passes. |
| 14 | +# |
| 15 | +# Usage: |
| 16 | +# cd ~/Projects (or wherever Noema/ lives) |
| 17 | +# bash Noema/scripts/rename-project-directory.sh |
| 18 | + |
| 19 | +set -euo pipefail |
| 20 | + |
| 21 | +OLD="Noema" |
| 22 | +NEW="Codifide" |
| 23 | + |
| 24 | +here="$(pwd)" |
| 25 | +old_path="${here}/${OLD}" |
| 26 | +new_path="${here}/${NEW}" |
| 27 | + |
| 28 | +if [ ! -d "$old_path" ]; then |
| 29 | + echo "error: ${old_path} does not exist." |
| 30 | + echo "Run this script from the directory that contains ${OLD}/" |
| 31 | + exit 1 |
| 32 | +fi |
| 33 | + |
| 34 | +if [ -e "$new_path" ]; then |
| 35 | + echo "error: ${new_path} already exists. Refusing to clobber." |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | + |
| 39 | +# Guard against running from inside the directory we're moving. |
| 40 | +# `pwd -P` resolves symlinks, matching what macOS gives us. |
| 41 | +case "$here" in |
| 42 | + "$old_path"|"$old_path"/*) |
| 43 | + echo "error: you are inside ${old_path}. cd out before running." |
| 44 | + exit 1 |
| 45 | + ;; |
| 46 | +esac |
| 47 | + |
| 48 | +echo "Moving ${old_path} -> ${new_path}" |
| 49 | +mv "$old_path" "$new_path" |
| 50 | + |
| 51 | +echo "Verifying the move..." |
| 52 | +if [ -d "$new_path/codifide" ] && [ -f "$new_path/README.md" ]; then |
| 53 | + echo "OK: directory contents look right." |
| 54 | +else |
| 55 | + echo "warning: expected contents not found. Inspect ${new_path}." |
| 56 | + exit 1 |
| 57 | +fi |
| 58 | + |
| 59 | +echo |
| 60 | +echo "Done. Next steps:" |
| 61 | +echo " cd ${new_path}" |
| 62 | +echo " python3 -m codifide test # confirm 122 passing" |
| 63 | +echo " cargo test --release -p codifide-canonical # confirm 10 passing" |
| 64 | +echo |
| 65 | +echo "If you use shell history, IDE workspaces, or Git remotes that" |
| 66 | +echo "reference the old path, update those separately. Nothing inside" |
| 67 | +echo "the repository depends on the parent directory name." |
0 commit comments