diff options
| -rwxr-xr-x | bin/shuriken | 8 | ||||
| -rw-r--r-- | src/lib/album.source.sh | 8 | ||||
| -rwxr-xr-x | tests/cli.sh | 36 |
3 files changed, 52 insertions, 0 deletions
diff --git a/bin/shuriken b/bin/shuriken index 40f35c2..c958ee1 100755 --- a/bin/shuriken +++ b/bin/shuriken @@ -2718,6 +2718,7 @@ print_dry_run_plan() { printf 'Random seed: %s\n' "${plan_ref["random_seed"]}" printf 'Shuffle: %s\n' "${plan_ref["shuffle"]}" printf 'Splash page: %s\n' "${plan_ref["splash_page"]}" + printf 'Stats page: %s\n' "${plan_ref["stats_page"]}" printf 'Image count: %s\n' "${plan_ref["image_count"]}" printf 'Tarball setting: %s\n' "${plan_ref["tarball_include"]}" printf 'Tarball name plan: %s\n' "${plan_ref["tarball_name_plan"]}" @@ -2752,6 +2753,13 @@ print_dry_run_plan() { "${plan_ref["dist_dir"]}" "${plan_ref["details_count"]}" printf ' %s/[redirect].html (%s navigation redirects)\n' \ "${plan_ref["dist_dir"]}" "${plan_ref["redirect_count"]}" + if [ "${plan_ref["stats_page"]}" = yes ]; then + # The exact camera-page count needs EXIF aggregation, which dry-run + # does not perform, so list them as a wildcard. + printf ' %s/stats.html (EXIF stats page)\n' "${plan_ref["dist_dir"]}" + printf ' %s/camera-*.html (per-camera pages)\n' \ + "${plan_ref["dist_dir"]}" + fi if [ "${plan_ref["tarball_include"]}" = yes ]; then printf ' %s/%s\n' \ "${plan_ref["dist_dir"]}" "${plan_ref["tarball_name_plan"]}" diff --git a/src/lib/album.source.sh b/src/lib/album.source.sh index c9812a2..57727d3 100644 --- a/src/lib/album.source.sh +++ b/src/lib/album.source.sh @@ -1204,6 +1204,7 @@ print_dry_run_plan() { printf 'Random seed: %s\n' "${plan_ref["random_seed"]}" printf 'Shuffle: %s\n' "${plan_ref["shuffle"]}" printf 'Splash page: %s\n' "${plan_ref["splash_page"]}" + printf 'Stats page: %s\n' "${plan_ref["stats_page"]}" printf 'Image count: %s\n' "${plan_ref["image_count"]}" printf 'Tarball setting: %s\n' "${plan_ref["tarball_include"]}" printf 'Tarball name plan: %s\n' "${plan_ref["tarball_name_plan"]}" @@ -1238,6 +1239,13 @@ print_dry_run_plan() { "${plan_ref["dist_dir"]}" "${plan_ref["details_count"]}" printf ' %s/[redirect].html (%s navigation redirects)\n' \ "${plan_ref["dist_dir"]}" "${plan_ref["redirect_count"]}" + if [ "${plan_ref["stats_page"]}" = yes ]; then + # The exact camera-page count needs EXIF aggregation, which dry-run + # does not perform, so list them as a wildcard. + printf ' %s/stats.html (EXIF stats page)\n' "${plan_ref["dist_dir"]}" + printf ' %s/camera-*.html (per-camera pages)\n' \ + "${plan_ref["dist_dir"]}" + fi if [ "${plan_ref["tarball_include"]}" = yes ]; then printf ' %s/%s\n' \ "${plan_ref["dist_dir"]}" "${plan_ref["tarball_name_plan"]}" diff --git a/tests/cli.sh b/tests/cli.sh index 6f56dad..a78741a 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -1838,6 +1838,7 @@ test_dry_run_reports_cli_overrides_without_writes() { test::assert_contains 'Random seed: dry-seed' "$output" test::assert_contains 'Shuffle: yes' "$output" test::assert_contains 'Splash page: no' "$output" + test::assert_contains 'Stats page: yes' "$output" test::assert_contains 'Image count: 6' "$output" test::assert_contains 'Tarball setting: yes' "$output" test::assert_contains 'Tarball name plan: incoming-<timestamp>.tar' \ @@ -1864,6 +1865,9 @@ test_dry_run_reports_cli_overrides_without_writes() { test::assert_contains \ " $dist_dir/[redirect].html (14 navigation redirects)" \ "$output" + test::assert_contains " $dist_dir/stats.html (EXIF stats page)" "$output" + test::assert_contains " $dist_dir/camera-*.html (per-camera pages)" \ + "$output" test::assert_not_contains "$dist_dir/html" "$output" test::assert_contains " $dist_dir/incoming-<timestamp>.tar" "$output" test::assert_not_contains 'Processing ' "$output" @@ -1875,6 +1879,35 @@ test_dry_run_reports_cli_overrides_without_writes() { test::teardown } +test_dry_run_no_stats_omits_stats_plan() { + local config_file + local dist_dir + local fake_bin + local output + + test::setup + fake_bin="$TEST_TMPDIR/bin" + config_file="$TEST_TMPDIR/shuriken.conf" + dist_dir="$TEST_TMPDIR/dist" + + test::install_fake_imagemagick "$fake_bin" + PATH="$fake_bin:$PATH" \ + test::generate_fixture_images "$TEST_TMPDIR/incoming" + test::write_album_config \ + "$config_file" "$TEST_TMPDIR/incoming" "$dist_dir" 'Dry no stats' 40 + + output=$( + cd "$TEST_TMPDIR" + PATH="$fake_bin:$PATH" "$TEST_SHURIKEN" --dry-run --no-stats + ) + + test::assert_contains 'Stats page: no' "$output" + test::assert_not_contains 'stats.html (EXIF stats page)' "$output" + test::assert_not_contains 'camera-*.html (per-camera pages)' "$output" + test::assert_path_absent "$dist_dir" + test::teardown +} + test_dry_run_reports_empty_plan_without_writes() { local config_file local dist_dir @@ -5507,6 +5540,9 @@ main() { '--dry-run reports CLI overrides without writes' \ test_dry_run_reports_cli_overrides_without_writes test::run_case \ + '--dry-run --no-stats omits stats from the plan' \ + test_dry_run_no_stats_omits_stats_plan + test::run_case \ '--dry-run reports empty plan without writes' \ test_dry_run_reports_empty_plan_without_writes test::run_case \ |
