#!/bin/bash

read -p "If your bundle is going to be \"pcm/example-bundle\", type \"ExampleBundle\".
Please enter the name of your bundle: " ANS

echo "Changing ExampleBundle to $ANS."

# When running sed, the `-i "" e` is for MacOS, and I think it writes the files instead of sending to stdout?
find . -type f ! -name "quickstart" ! -name "README.md" ! -name "LICENSE" ! -path "*/.*" ! -wholename "*/vendor/*" -exec sed -i "" -e "s/ExampleBundle/$ANS/g" {} ';'

# Rename PcmExampleBundle
mv src/PcmExampleBundle.php src/Pcm${ANS}.php

echo "Ok that's probably worked, check git to make sure though."
echo "Also don't forget to update the name and description key in composer.json if you haven't already!"

echo "Installing dependencies..."
docker compose run php composer install

