basic_signup_allowlist/rename_module.sh
2025-09-16 09:09:51 +00:00

46 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Script to rename BasicSignupWhitelist module to BasicSignupAllowlist
# This includes renaming files, module names, function names, and all references
echo "Starting module rename from Whitelist to Allowlist..."
# 1. Rename the files
echo "Renaming files..."
if [ -f "lib/basic_signup_whitelist.ex" ]; then
mv lib/basic_signup_whitelist.ex lib/basic_signup_allowlist.ex
echo " ✓ Renamed lib/basic_signup_whitelist.ex to lib/basic_signup_allowlist.ex"
fi
if [ -f "test/basic_signup_whitelist_test.exs" ]; then
mv test/basic_signup_whitelist_test.exs test/basic_signup_allowlist_test.exs
echo " ✓ Renamed test/basic_signup_whitelist_test.exs to test/basic_signup_allowlist_test.exs"
fi
# 2. Replace all occurrences of BasicSignupWhitelist with BasicSignupAllowlist
echo "Updating module names..."
find . -type f \( -name "*.ex" -o -name "*.exs" \) -exec sed -i 's/BasicSignupWhitelist/BasicSignupAllowlist/g' {} +
echo " ✓ Updated module names from BasicSignupWhitelist to BasicSignupAllowlist"
# 3. Replace function names (mail_whitelisted -> mail_allowlisted)
echo "Updating function names..."
find . -type f \( -name "*.ex" -o -name "*.exs" \) -exec sed -i 's/mail_whitelisted/mail_allowlisted/g' {} +
echo " ✓ Updated function names from mail_whitelisted to mail_allowlisted"
# 4. Replace any remaining "whitelist" references in comments/docs with "allowlist"
echo "Updating remaining whitelist references..."
find . -type f \( -name "*.ex" -o -name "*.exs" \) -exec sed -i 's/whitelist/allowlist/g' {} +
echo " ✓ Updated all remaining references from whitelist to allowlist"
# 5. Update any references to the old filenames in mix.exs or other config files
echo "Checking for filename references in config files..."
if [ -f "mix.exs" ]; then
sed -i 's/basic_signup_whitelist/basic_signup_allowlist/g' mix.exs
echo " ✓ Updated references in mix.exs"
fi
echo ""
echo "Module rename complete! You may want to:"
echo " 1. Run 'mix test' to ensure all tests still pass"
echo " 2. Run 'mix compile --force' to recompile with the new module names"
echo " 3. Check any documentation or README files for references to update"