From 9aacfcc4c5b102c8cda195932addefd32fe955d2 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sun, 16 Jun 2019 21:27:26 -0400 Subject: [PATCH] Add a script to help diff rendered books --- tools/megadiff.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/megadiff.sh diff --git a/tools/megadiff.sh b/tools/megadiff.sh new file mode 100755 index 0000000000..9b0d943896 --- /dev/null +++ b/tools/megadiff.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -eu + +# Remove files that are never affected by rustfmt or are otherwise uninteresting +rm -rf tmp/book-before/css/ tmp/book-before/theme/ tmp/book-before/img/ tmp/book-before/*.js \ + tmp/book-before/FontAwesome tmp/book-before/*.css tmp/book-before/*.png \ + tmp/book-before/*.json tmp/book-before/print.html + +rm -rf tmp/book-after/css/ tmp/book-after/theme/ tmp/book-after/img/ tmp/book-after/*.js \ + tmp/book-after/FontAwesome tmp/book-after/*.css tmp/book-after/*.png \ + tmp/book-after/*.json tmp/book-after/print.html + +# Get all the html files before +ls tmp/book-before/*.html | \ +# Extract just the filename so we can reuse it easily. +xargs -n 1 basename | \ +while IFS= read -r filename; do + # Remove any files that are the same before and after + diff "tmp/book-before/$filename" "tmp/book-after/$filename" > /dev/null \ + && rm "tmp/book-before/$filename" "tmp/book-after/$filename" +done