Skip to content

Commit

Permalink
Merge branch 'hotfix/8.9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispelzer committed Apr 18, 2024
2 parents c7cf017 + ba6e445 commit 7f83f9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions hooks/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

# Run on either wild wayne or local machine
wild_wayne_test=${WILD_WAYNE}
# Run the pre-commit hook to check for any errors before committing
# ${DOCKER_ENV} comes from the environment variables in the docker-compose.yml file for the wsu docker container
docker_test=${DOCKER_ENV}

# Current working directory of the site
site_folder=${PWD##*/}

export PATH=/usr/local/bin:$PATH
echo "Folder: ${site_folder}";

# Make sure vagrant command is found
if [ "$wild_wayne_test" != "true" ]; then
if hash vagrant 2>/dev/null; then
printf "vagrant command found...\n"
if [ "${docker_test}" != "true" ]; then
if [ "$(which docker)" != "" ]; then
printf "docker command found...\n"
else
printf "Vagrant command could not be found. If you plan to develop without using vagrant then delete this check.\n"
printf "Docker command could not be found. If you plan to develop without using docker then delete this check.\n"
exit 1
fi
fi
Expand All @@ -28,12 +30,12 @@ if [[ "$branch" == "master" ]]; then
fi

# PHP linting
if [ "$wild_wayne_test" = "true" ]; then
if [ "${docker_test}" = "true" ]; then
printf "Running phplint...\n"
phplint="$(make phplintdry)"
else
printf "Running phplint...\n"
phplint="$(vagrant ssh -c "cd /vagrant/${site_folder}; make phplintdry")"
phplint="$(docker exec -i wsu-${site_folder} bash -i -c "make phplintdry")"
fi

# Check if the last command (PHPLint) didn't exit with a 0 success
Expand All @@ -44,12 +46,12 @@ if (( $? != 0 )); then
fi

# Style linting
if [ "$wild_wayne_test" = "true" ]; then
if [ "${docker_test}" = "true" ]; then
printf "Running stylelint...\n"
stylelint="$(make stylelint)"
else
printf "Running stylelint...\n"
stylelint="$(vagrant ssh -c "cd /vagrant/${site_folder}; make stylelint")"
stylelint="$(docker exec -i wsu-${site_folder} bash -i -c "make stylelint")"
fi

# Check if the last command (Stylelint) didn't exit with a 0 success
Expand All @@ -60,12 +62,12 @@ if (( $? != 0 )); then
fi

# PHP tests
if [ "$wild_wayne_test" = "true" ]; then
if [ "${docker_test}" = "true" ]; then
printf "Running tests...\n"
phpunit="$(phpunit)"
else
printf "Running tests...\n"
phpunit="$(vagrant ssh -c "cd /vagrant/${site_folder}; phpunit")"
phpunit="$(docker exec -i wsu-${site_folder} bash -i -c "phpunit")"
fi

# Check if the last command (PHPUnit) didn't exit with a 0 success
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "base",
"private": true,
"version": "8.9.2",
"version": "8.9.3",
"description": "",
"scripts": {
"dev": "npm run development",
Expand Down

0 comments on commit 7f83f9d

Please sign in to comment.