Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlink problem-specifications for easy reference #1737

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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