Skip to content

Commit

Permalink
Symlink problem-specifications for easy reference
Browse files Browse the repository at this point in the history
This is handy when referring to `canonical-data.json` of an exercise,
while creating / updating the test template for it.
It's all available in the same spot.
  • Loading branch information
senekor committed Sep 14, 2023
1 parent 837fa81 commit 391aa5f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tmp
exercises/*/*/Cargo.lock
exercises/*/*/clippy.log
.vscode
.prob-spec
12 changes: 12 additions & 0 deletions bin/symlink_problem_specifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

cd "$(git rev-parse --show-toplevel)"

for exercise in exercises/practice/*; do
name="$(basename "$exercise")"
if [ -d "problem-specifications/exercises/$name" ]; then
[ -e "$exercise/.prob-spec" ] && rm "$exercise/.prob-spec"
ln -s "../../../problem-specifications/exercises/$name" "$exercise/.prob-spec"
fi
done
5 changes: 5 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ Find some tips about writing tera templates [in the next section](#tera-template
The full documentation for tera templates is [here][tera-docs].
Following are some approaches that have worked for our specific needs.

You will likely want to look at the exercise's `canonical-data.json`
to see what structure your input data has.
You can use `bin/symlink_problem_specifications.sh` to have this data
symlinked into the actual exercise directory. Handy!

The name of the input property is different for each exercise.
The default template will be something like this:

Expand Down

0 comments on commit 391aa5f

Please sign in to comment.