forked from paf31/purescript-book
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: merge removeAnchors.sh and resetSolutions.sh (#457)
* scripts: merge removeAnchors.sh and resetSolutions.sh Keeping it all in a single `scripts/prepareExercises.sh` avoids duplication. Also remove the complex file finding; simply getting all source files within the `exercises` directory is a perfect fit for what is needed. This fixes Issue #430. * Simplify scripts/prepareExercises.sh * Add prepareExercises.sh to CI --------- Co-authored-by: Miles Frain <[email protected]>
- Loading branch information
1 parent
4edad29
commit 427f698
Showing
5 changed files
with
32 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script removes meta information that is not intended for readers of the book | ||
|
||
# Echo commands to shell | ||
set -x | ||
# Exit on first failure | ||
set -e | ||
|
||
# For all chapters | ||
for d in exercises/chapter*; do | ||
# All .purs & .js files of chapter exercises | ||
FILES=$(find $d/src $d/test -name '*.purs' -o -name '*.js') | ||
|
||
for f in $FILES; do | ||
# Delete lines starting with an 'ANCHOR' comment | ||
perl -ni -e 'print if !/^\s*(--|\/\/) ANCHOR/' $f | ||
|
||
# Delete lines with a note to delete them | ||
perl -ni -e 'print if !/This line should have been automatically deleted/' $f | ||
done | ||
|
||
# If there's a no-peeking directory | ||
if [ -d $d/test/no-peeking ]; then | ||
# Move 'no-peeking' sources out of the compilation path | ||
mv $d/test/no-peeking $d | ||
fi | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters