Skip to content

Commit fa901df

Browse files
authored
Merge pull request #47 from TerrorSquad/refactor/split-integration-script
Refactor integration script into modular components and add build pro…
2 parents 9b9f77b + a49ccf6 commit fa901df

File tree

18 files changed

+2000
-327
lines changed

18 files changed

+2000
-327
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help test test-laravel test-symfony test-hooks test-clean test-env test-status
1+
.PHONY: help test test-laravel test-symfony test-hooks test-clean test-env test-status build
22

33
# Default target - show help
44
help:
@@ -7,6 +7,7 @@ help:
77
@echo "Usage: make <target>"
88
@echo ""
99
@echo "Available targets:"
10+
@echo " build Build the integration script"
1011
@echo " test Run full integration test (Laravel)"
1112
@echo " test-laravel Run full Laravel integration test"
1213
@echo " test-symfony Run full Symfony integration test"
@@ -20,6 +21,10 @@ help:
2021
@echo " make test-symfony # Test Symfony integration"
2122
@echo " make test-clean # Clean up after tests"
2223

24+
# Build the integration script
25+
build:
26+
@bash booster/build.sh
27+
2328
# Default test target (Laravel)
2429
test: test-laravel
2530

booster/.ddev/scripts/setup-psalm-symlink.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,19 @@ PARENT_DIR=$(dirname "$HOST_ROOT")
1616
docker exec -u root "$CONTAINER_NAME" mkdir -p "$PARENT_DIR"
1717

1818
# Create the symlink: HOST_ROOT -> /var/www/html
19+
# This "Symlink Hack" allows Psalm running inside the container to use the same absolute paths
20+
# as the host machine. This enables VS Code to map errors back to the correct files without
21+
# complex path mapping configurations in the extension.
22+
#
1923
# -s: symbolic link
2024
# -f: force (remove existing destination file)
2125
# -n: no dereference (treat destination as normal file if it is a symlink to a directory)
2226
docker exec -u root "$CONTAINER_NAME" ln -sfn /var/www/html "$HOST_ROOT"
2327

2428
echo "Symlink created: $HOST_ROOT -> /var/www/html inside $CONTAINER_NAME"
29+
30+
# Ensure psalm symlink exists if psalm.phar is present but psalm is not
31+
# This allows using 'psalm' command consistently even if only psalm.phar is installed
32+
if [ -f "vendor/bin/psalm.phar" ] && [ ! -f "vendor/bin/psalm" ]; then
33+
ln -s psalm.phar "vendor/bin/psalm"
34+
fi
File renamed without changes.

booster/.husky/shared/runner.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ fi
2222
# Change to project root to ensure context is correct
2323
cd "$PROJECT_ROOT" || exit 1
2424

25-
# Ensure psalm symlink exists if psalm.phar is present but psalm is not
26-
# This allows using 'psalm' command consistently even if only psalm.phar is installed
27-
if [ -f "vendor/bin/psalm.phar" ] && [ ! -f "vendor/bin/psalm" ]; then
28-
ln -s psalm.phar "vendor/bin/psalm"
29-
fi
30-
3125
# Load mise if available to ensure pnpm is found
3226
if command -v mise &> /dev/null; then
3327
eval "$(mise activate bash)"

booster/build.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
# Build script to compile the integration script from source
4+
5+
# Get the directory of the script
6+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7+
cd "$DIR"
8+
9+
SRC_DIR="src"
10+
OUTPUT_FILE="integrate_booster.sh"
11+
12+
TMP_FILE="${OUTPUT_FILE}.tmp.$$"
13+
14+
# Clean up temporary file on error
15+
trap 'rm -f "$TMP_FILE"' ERR
16+
17+
echo "Building $OUTPUT_FILE..."
18+
19+
# Ensure temporary output file is empty
20+
> "$TMP_FILE"
21+
22+
# Concatenate files in the correct order
23+
cat "$SRC_DIR/header.sh" >> "$TMP_FILE"
24+
echo "" >> "$TMP_FILE"
25+
26+
cat "$SRC_DIR/lib/version.sh" >> "$TMP_FILE"
27+
echo "" >> "$TMP_FILE"
28+
29+
cat "$SRC_DIR/lib/logging.sh" >> "$TMP_FILE"
30+
echo "" >> "$TMP_FILE"
31+
32+
cat "$SRC_DIR/lib/interactive.sh" >> "$TMP_FILE"
33+
echo "" >> "$TMP_FILE"
34+
35+
cat "$SRC_DIR/lib/utils.sh" >> "$TMP_FILE"
36+
echo "" >> "$TMP_FILE"
37+
38+
cat "$SRC_DIR/lib/files.sh" >> "$TMP_FILE"
39+
echo "" >> "$TMP_FILE"
40+
41+
cat "$SRC_DIR/lib/ddev.sh" >> "$TMP_FILE"
42+
echo "" >> "$TMP_FILE"
43+
44+
cat "$SRC_DIR/lib/composer.sh" >> "$TMP_FILE"
45+
echo "" >> "$TMP_FILE"
46+
47+
cat "$SRC_DIR/lib/node.sh" >> "$TMP_FILE"
48+
echo "" >> "$TMP_FILE"
49+
50+
cat "$SRC_DIR/main.sh" >> "$TMP_FILE"
51+
52+
chmod +x "$TMP_FILE"
53+
mv "$TMP_FILE" "$OUTPUT_FILE"
54+
55+
echo "Build complete: $OUTPUT_FILE"

booster/deptrac.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
deptrac:
2+
paths:
3+
- ./src
4+
- ./app
5+
layers:
6+
- name: Controller
7+
collectors:
8+
- type: className
9+
regex: .*Controller.*
10+
- name: Service
11+
collectors:
12+
- type: className
13+
regex: .*Service.*
14+
- name: Repository
15+
collectors:
16+
- type: className
17+
regex: .*Repository.*
18+
- name: Model
19+
collectors:
20+
- type: className
21+
regex: .*Model.*
22+
ruleset:
23+
Controller:
24+
- Service
25+
- Repository
26+
- Model
27+
Service:
28+
- Repository
29+
- Model
30+
Repository:
31+
- Model
32+
Model: []

0 commit comments

Comments
 (0)