30 lines
754 B
Bash
Executable File
30 lines
754 B
Bash
Executable File
#!/bin/bash
|
|
# Setup script to install git hooks
|
|
# Run this after cloning the repository
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
GIT_HOOKS_DIR="$SCRIPT_DIR/.git/hooks"
|
|
SOURCE_HOOKS_DIR="$SCRIPT_DIR/git-hooks"
|
|
|
|
echo "Setting up git hooks..."
|
|
|
|
# Create .git/hooks directory if it doesn't exist
|
|
mkdir -p "$GIT_HOOKS_DIR"
|
|
|
|
# Copy pre-push hook
|
|
if [ -f "$SOURCE_HOOKS_DIR/pre-push" ]; then
|
|
cp "$SOURCE_HOOKS_DIR/pre-push" "$GIT_HOOKS_DIR/pre-push"
|
|
chmod +x "$GIT_HOOKS_DIR/pre-push"
|
|
echo "✓ Installed pre-push hook"
|
|
else
|
|
echo "✗ pre-push hook not found in git-hooks/"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Git hooks installed successfully!"
|
|
echo "PDFs will be automatically generated before each push."
|
|
|