dev_setup.sh (555B)
1 #!/usr/bin/env bash 2 3 HOOK_SCRIPTS_DIR="scripts" 4 GIT_HOOKS_DIR=".git/hooks" 5 6 # Ensure the necessary directories exist and are accessible 7 if [ ! -d "$HOOK_SCRIPTS_DIR" ] || [ ! -d "$GIT_HOOKS_DIR" ]; then 8 echo "Error: Required directories are missing. Please ensure you are in the project's root directory." 9 exit 1 10 fi 11 12 # Copy the pre-commit hook script 13 cp -p "$HOOK_SCRIPTS_DIR/pre_commit_hook.sh" "$GIT_HOOKS_DIR/pre-commit" 14 15 # Make the hook script executable 16 chmod +x "$GIT_HOOKS_DIR/pre-commit" 17 18 echo "Pre-commit hook has been set up successfully." 19