Skip to content
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
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ Maintainers are happy to interact with humans; maintainers are not interested in
```
# Use the configlet to set things up.
$ ./bin/fetch-configlet
$ ./bin/configlet create --practice-exercise $slug -a $author -d $difficulty
$ ./bin/configlet create --practice-exercise "${slug}" -a "${author}" -d "${difficulty}"
# Sort `config.json`.
$ sorted=$( jq ' (.exercises.practice |= sort_by(.slug)) | .exercises.practice |= sort_by(.difficulty)' config.json ) && echo "$sorted" > config.json
$ ./bin/sort_exercises
# Add the test runner.
$ ./bin/update_test_runner
# It's recommended you copy a .meta/template.j2 from another exercise as a starting point.
# Edit the template file and use it to regenerate tests. The problem spec repo should be updated at least once.
$ ./bin/generate_tests [--no-pull]
# Solve the exercise and validate by running the tests.
$ ( cd exercises/practice/$slug && bash run_tests; )
$ ( cd "exercises/practice/${slug}" && bash run_tests; )
```

### Error handling
Expand Down
15 changes: 15 additions & 0 deletions bin/sort_exercises
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

self=$(readlink -e "$0")
bin=${self%/*}

# shellcheck disable=SC1091
. "${bin}/utils.bash"

config="${REPO_ROOT}/config.json"

sorted=$( jq '
(.exercises.practice |= sort_by(.name | ascii_downcase)) |
.exercises.practice |= sort_by(.difficulty)
' "${config}" )
printf '%s\n' "${sorted}" > "${config}"
Loading