dev.sh will now work outside of the git repository
Some checks failed
Actions / Build and Upload Export Files (push) Failing after 6s
Actions / Autotagger (push) Successful in 8s
Actions / Build Documentation (push) Failing after 18s

This commit is contained in:
Seaswimmer 2024-06-09 16:23:09 -04:00
parent 361f578783
commit b375c1b922
Signed by: cswimr
GPG key ID: 3813315477F26F82

View file

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
# Set the script directory and project root directory
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$script_dir" || exit 1
project_root=$(git rev-parse --show-toplevel)
# Function to install packwiz and add it to the system path # Function to install packwiz and add it to the system path
install_packwiz() { install_packwiz() {
# Download packwiz executable # Download packwiz executable
@ -12,7 +17,7 @@ install_packwiz() {
# Add packwiz to the system path # Add packwiz to the system path
if [[ ! ":$PATH:" == *":/usr/local/bin:"* ]]; then if [[ ! ":$PATH:" == *":/usr/local/bin:"* ]]; then
echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc echo "export PATH='$PATH:/usr/local/bin'" >> ~/.bashrc
fi fi
# Generate autocompletion script # Generate autocompletion script
@ -23,25 +28,25 @@ install_packwiz() {
else else
echo "packwiz autocompletion already enabled" echo "packwiz autocompletion already enabled"
fi fi
source ~/.bashrc source ~/.bashrc
} }
# Function to create symlink for pre-commit hook # Function to create symlink for pre-commit hook
create_symlink() { create_symlink() {
# Check if .git/hooks directory exists # Check if .git/hooks directory exists
if [ ! -d ".git/hooks" ]; then if [ ! -d "$project_root/.git/hooks" ]; then
echo "Error: .git/hooks directory does not exist" mkdir -p "$project_root/.git/hooks"
exit 1
fi fi
# Delete old symlink # Delete old symlink
rm -f "$(pwd)/.git/hooks/post-commit" rm -f "$project_root/.git/hooks/post-commit"
# Create symlink for pre-commit hook # Create symlink for post-commit hook
ln -s "$(pwd)/scripts/hooks/post-commit" "$(pwd)/.git/hooks/post-commit" ln -s "$project_root/scripts/hooks/post-commit" "$project_root/.git/hooks/post-commit"
# Verify symlink creation # Verify symlink creation
ls -l .git/hooks/post-commit ls -l "$project_root/.git/hooks/post-commit"
} }
# Main function # Main function