diff --git a/Makefile b/Makefile index 9fdd526..b449361 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ help: @echo " woke - Check inclusive language with woke" @echo "" @echo " Documentation Aggregation:" + @echo " aggregate-local - Aggregate from local repos using relative paths (../gardenlinux ../builder ../python-gardenlinux-lib)" @echo " test-aggregate-local - Test aggregation with local repos (recommended first)" @echo " aggregate - Fetch and aggregate docs from all source repos" @echo " aggregate-dry - Test aggregation without modifying docs/" @@ -71,6 +72,10 @@ test-aggregate-local: install @echo "Testing aggregation with local repositories..." ./scripts/test-local.sh --dry-run +aggregate-local: install + @echo "Aggregating from local repositories (relative paths)..." + CONFIG_FILE=scripts/repos-config.local.json ./scripts/aggregate-docs.sh + aggregate: install @echo "Aggregating documentation from source repositories..." ./scripts/aggregate-docs.sh diff --git a/scripts/aggregate-docs.sh b/scripts/aggregate-docs.sh index 2afc569..932351a 100755 --- a/scripts/aggregate-docs.sh +++ b/scripts/aggregate-docs.sh @@ -8,7 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" DOCS_DIR="$PROJECT_ROOT/docs" TEMP_DIR=$(mktemp -d) -CONFIG_FILE="$SCRIPT_DIR/repos-config.json" +CONFIG_FILE="${CONFIG_FILE:-$SCRIPT_DIR/repos-config.json}" echo "==============================================================" echo " Garden Linux Documentation Aggregation" diff --git a/scripts/fetch-repo-docs.sh b/scripts/fetch-repo-docs.sh index 110f971..eb60e69 100755 --- a/scripts/fetch-repo-docs.sh +++ b/scripts/fetch-repo-docs.sh @@ -4,6 +4,7 @@ set -e +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_URL="$1" BRANCH="${2:-main}" DOCS_PATH="${3:-docs}" @@ -18,6 +19,13 @@ if [ -z "$REPO_URL" ] || [ -z "$OUTPUT_DIR" ]; then exit 1 fi +# Convert relative file:// URLs to absolute paths +if [[ "$REPO_URL" == file://../* ]]; then + RELATIVE_PATH="${REPO_URL#file://}" + ABSOLUTE_PATH="$(cd "$SCRIPT_DIR/.." && cd "$RELATIVE_PATH" && pwd)" + REPO_URL="file://$ABSOLUTE_PATH" +fi + echo "Fetching docs from: $REPO_URL" echo " Branch: $BRANCH" echo " Docs path: $DOCS_PATH" diff --git a/scripts/repos-config.local.json b/scripts/repos-config.local.json index 9e0289c..6768ac1 100644 --- a/scripts/repos-config.local.json +++ b/scripts/repos-config.local.json @@ -2,8 +2,9 @@ "repos": [ { "name": "gardenlinux", - "url": "file:///home/$USER/*/gardenlinux/gardenlinux", + "url": "file://../gardenlinux", "docs_path": "docs", + "root_files": ["CONTRIBUTING.md", "SECURITY.md"], "target_path": "projects/gardenlinux", "branch": "docs-ng", "structure": { @@ -18,7 +19,7 @@ }, { "name": "builder", - "url": "file:///home/$USER/*/gardenlinux/builder", + "url": "file://../builder", "docs_path": "docs", "target_path": "projects/builder", "branch": "main", @@ -26,7 +27,7 @@ }, { "name": "python-gardenlinux-lib", - "url": "file:///home/$USER/*/gardenlinux/python-gardenlinux-lib", + "url": "file://../python-gardenlinux-lib", "docs_path": "docs", "target_path": "projects/python-gardenlinux-lib", "branch": "main",