From: Christian Heller Date: Wed, 25 Jan 2017 01:52:08 +0000 (+0100) Subject: Add captcha files support. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/bar%20baz.html?a=commitdiff_plain;h=0dddf8e27165915e413feaa4a6acf234e4ca5d17;p=redo-blog Add captcha files support. --- diff --git a/processor/captchas/default.do b/processor/captchas/default.do new file mode 100644 index 0000000..dc28477 --- /dev/null +++ b/processor/captchas/default.do @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -f "$1" ]; then + printf "apple\napple" +fi diff --git a/processor/default.html.do b/processor/default.html.do index c744889..ba163e2 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -10,6 +10,7 @@ prep_url() { # Pull in global dependencies. . ./helpers.sh metadata_dir=metadata +captchas_dir=captchas meta_file="${metadata_dir}/${1%.html}.automatic_metadata" redo-ifchange "$meta_file" intermediate_file="${metadata_dir}/${1%.html}.intermediate" @@ -22,6 +23,8 @@ linkback_tmpl_file="${metadata_dir}"/linkback.tmpl redo-ifchange "$linkback_tmpl_file" replies_file="${1%.html}.links" redo-ifchange "$replies_file" +captcha_file="$captchas_dir/${1%.html}" +redo-ifchange "$captcha_file" # Build entry data. blog_title=$(read_and_escape_file "$title_file" | head -1 | prep_sed) diff --git a/test.sh b/test.sh index ce50d29..10b6fd9 100755 --- a/test.sh +++ b/test.sh @@ -93,12 +93,20 @@ done # Compare .links files. cd "$working_dir" -for file in "$expected_files_dir"/*.links "$expected_files_dir"/*.captcha; do +for file in "$expected_files_dir"/*.links; do basename=$(basename "$file") cmp_file="$generated_files_dir/$basename" diff_test "$file" "$cmp_file" done +# Compare captcha files. +cd "$working_dir" +for file in "$expected_files_dir"/captchas/*; do + basename=$(basename "$file") + cmp_file="$generated_files_dir/captchas/$basename" + diff_test "$file" "$cmp_file" +done + # Compare generated HTML files. Ignore variable dates. for file in "$expected_files_dir"/*.html.ignoring; do basename=$(basename "$file") diff --git a/test/test_files/captchas/bar baz b/test/test_files/captchas/bar baz new file mode 100644 index 0000000..42bf241 --- /dev/null +++ b/test/test_files/captchas/bar baz @@ -0,0 +1,2 @@ +apple +apple \ No newline at end of file diff --git a/test/test_files/captchas/foo b/test/test_files/captchas/foo new file mode 100644 index 0000000..42bf241 --- /dev/null +++ b/test/test_files/captchas/foo @@ -0,0 +1,2 @@ +apple +apple \ No newline at end of file diff --git a/test/test_files/captchas/te"st b/test/test_files/captchas/te"st new file mode 100644 index 0000000..42bf241 --- /dev/null +++ b/test/test_files/captchas/te"st @@ -0,0 +1,2 @@ +apple +apple \ No newline at end of file