Skip to content

Commit

Permalink
Add a script to help diff rendered books
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Jun 17, 2019
1 parent 3ff9591 commit 9aacfcc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tools/megadiff.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9aacfcc

Please sign in to comment.