Skip to content

Commit 391aa5f

Browse files
committed
Symlink problem-specifications for easy reference
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.
1 parent 837fa81 commit 391aa5f

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ tmp
77
exercises/*/*/Cargo.lock
88
exercises/*/*/clippy.log
99
.vscode
10+
.prob-spec
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -eo pipefail
3+
4+
cd "$(git rev-parse --show-toplevel)"
5+
6+
for exercise in exercises/practice/*; do
7+
name="$(basename "$exercise")"
8+
if [ -d "problem-specifications/exercises/$name" ]; then
9+
[ -e "$exercise/.prob-spec" ] && rm "$exercise/.prob-spec"
10+
ln -s "../../../problem-specifications/exercises/$name" "$exercise/.prob-spec"
11+
fi
12+
done

docs/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ Find some tips about writing tera templates [in the next section](#tera-template
101101
The full documentation for tera templates is [here][tera-docs].
102102
Following are some approaches that have worked for our specific needs.
103103

104+
You will likely want to look at the exercise's `canonical-data.json`
105+
to see what structure your input data has.
106+
You can use `bin/symlink_problem_specifications.sh` to have this data
107+
symlinked into the actual exercise directory. Handy!
108+
104109
The name of the input property is different for each exercise.
105110
The default template will be something like this:
106111

0 commit comments

Comments
 (0)