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
# 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
install_packwiz() {
# Download packwiz executable
@ -12,36 +17,36 @@ install_packwiz() {
# Add packwiz to the system path
if [[ ! ":$PATH:" == *":/usr/local/bin:"* ]]; then
echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc
echo "export PATH='$PATH:/usr/local/bin'" >> ~/.bashrc
fi
# Generate autocompletion script
packwiz completion bash > ~/.packwiz
if ! grep -q "source ~/.packwiz" ~/.bashrc; then
if ! grep -q "source ~/.packwiz" ~/.bashrc; then
echo 'source ~/.packwiz' >> ~/.bashrc
echo "Successfully enabled packwiz autocompletion";
echo "Successfully enabled packwiz autocompletion";
else
echo "packwiz autocompletion already enabled"
echo "packwiz autocompletion already enabled"
fi
source ~/.bashrc
}
# Function to create symlink for pre-commit hook
create_symlink() {
# Check if .git/hooks directory exists
if [ ! -d ".git/hooks" ]; then
echo "Error: .git/hooks directory does not exist"
exit 1
if [ ! -d "$project_root/.git/hooks" ]; then
mkdir -p "$project_root/.git/hooks"
fi
# Delete old symlink
rm -f "$(pwd)/.git/hooks/post-commit"
rm -f "$project_root/.git/hooks/post-commit"
# Create symlink for pre-commit hook
ln -s "$(pwd)/scripts/hooks/post-commit" "$(pwd)/.git/hooks/post-commit"
# Create symlink for post-commit hook
ln -s "$project_root/scripts/hooks/post-commit" "$project_root/.git/hooks/post-commit"
# Verify symlink creation
ls -l .git/hooks/post-commit
ls -l "$project_root/.git/hooks/post-commit"
}
# Main function