diff --git a/scripts/check-all.sh b/scripts/check-all.sh index 005f70b..ba94e93 100755 --- a/scripts/check-all.sh +++ b/scripts/check-all.sh @@ -350,7 +350,7 @@ run_package() { } RECHECK=() -for pkg_file in $(printf '%s\n' "${AURTOMATOR_DIR}"/packages/*.yml | sort); do +for pkg_file in "${AURTOMATOR_DIR}"/packages/*.yml; do [[ -f "$pkg_file" ]] || continue run_package "$pkg_file" 1 done diff --git a/scripts/update-readme.sh b/scripts/update-readme.sh index 689353f..2b790b3 100755 --- a/scripts/update-readme.sh +++ b/scripts/update-readme.sh @@ -93,7 +93,7 @@ table_header="| Package | Version | Strategy | Updated | Status | pkg_count=0 pkg_ok=0 pkg_fail=0 -for pkg_file in $(printf '%s\n' "${AURTOMATOR_DIR}"/packages/*.yml | sort); do +for pkg_file in "${AURTOMATOR_DIR}"/packages/*.yml; do [[ -f "$pkg_file" ]] || continue name=$(pkg_get "$pkg_file" .name) diff --git a/tests/scripts.bats b/tests/scripts.bats index 992469e..7e0fae0 100644 --- a/tests/scripts.bats +++ b/tests/scripts.bats @@ -584,6 +584,36 @@ EOF [[ "$output" == *"Checked: 0"* ]] } +# === project path with a space === + +# Helper: a project at "$TEST_TMPDIR/my project" with the scripts and +# strategies of the test project and one package, pkg, that is up to date +make_spaced_project() { + SPACED="$TEST_TMPDIR/my project" + mkdir -p "$SPACED/packages" + ln -s "$TEST_TMPDIR/scripts" "$SPACED/scripts" + ln -s "$TEST_TMPDIR/strategies" "$SPACED/strategies" + printf '%s\n' "name: pkg" "strategy: github-release" "upstream:" " project: owner/repo" \ + "current: '2.0.0'" >"$SPACED/packages/pkg.yml" +} + +@test "check-all: finds the packages of a project whose path has a space" { + make_spaced_project + run "$SPACED/scripts/check-all.sh" + [ "$status" -eq 0 ] + [[ "$output" == *"Checked: 1, Updated: 0, Errors: 0"* ]] + [ "$(cat "$SPACED/.status/pkg")" = "up_to_date" ] +} + +@test "update-readme: lists the packages of a project whose path has a space" { + make_spaced_project + printf '%s\n' '' '' >"$SPACED/README.md" + git -C "$SPACED" init -q + run "$SPACED/scripts/update-readme.sh" + [ "$status" -eq 0 ] + grep -q '\[pkg\]' "$SPACED/README.md" +} + # === update-readme.sh === @test "update-readme: generates status table" {