Skip to content

Commit 8f0290d

Browse files
Add script to add practice exercise (#565)
1 parent 361a016 commit 8f0290d

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

building/tooling/best-practices.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ A very helpful command-line tool is [hyperfine](https://github.com/sharkdp/hyper
2222

2323
Newer track tooling repos will have access to the following two scripts:
2424

25-
1. `./bin/benchmark.sh`: benchmark the track tooling code ([source code](https://github.com/exercism/generic-test-runner/blob/a6886f4d84d2a2030f766a658c334bbfbe97b79c/bin/benchmark.sh))
26-
2. `./bin/benchmark-in-docker.sh`: benchmark the track tooling Docker image ([source code](https://github.com/exercism/generic-test-runner/blob/a6886f4d84d2a2030f766a658c334bbfbe97b79c/bin/benchmark-in-docker.sh))
25+
1. `./bin/benchmark.sh`: benchmark the track tooling code ([source code](https://github.com/exercism/generic-test-runner/blob/main/bin/benchmark.sh))
26+
2. `./bin/benchmark-in-docker.sh`: benchmark the track tooling Docker image ([source code](https://github.com/exercism/generic-test-runner/blob/main/bin/benchmark-in-docker.sh))
2727

28-
If you're working on a track tooling repo without these files, feel free to copy them into your repo.
28+
```exercism/note
29+
If you're working on a track tooling repo without these files, feel free to copy them into your repo using the above source links.
30+
```
2931

3032
```exercism/caution
3133
Benchmarking scripts can help estimate the tooling's performance.

building/tracks/new/add-first-exercise.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,40 @@ bin/fetch-configlet
7979
bin/configlet create --practice-exercise hello-world
8080
```
8181

82+
### Set author
83+
84+
To have the website list you as the exercise's author, follow these steps:
85+
86+
Within the exercise's `.meta/config.json` file:
87+
88+
- Add your GitHub username to the `authors` key
89+
90+
For this to work, you'll need link your Exercism account to GitHub.
91+
You can do this on the website in the [Settings page's Integrations section](https://exercism.org/settings/integrations).
92+
93+
```exercism/note
94+
Exercise authors are also awarded [reputation](/docs/using/product/reputation)
95+
```
96+
97+
### Use script
98+
99+
Newer track repos can use the `bin/add-practice-exercise` script ([source](https://github.com/exercism/generic-track/blob/main/bin/add-practice-exercise)) to add new exercises:
100+
101+
```shell
102+
bin/add-exercise -a <github_username> two-fer
103+
```
104+
105+
```exercism/note
106+
If you're working on a track repo without this file, feel free to copy them into your repo using the above source link.
107+
```
108+
82109
### Implement exercise
83110

84111
Once the scaffolded files have been created, you'll then have to:
85112

86113
- Add tests to the tests file
87114
- Add an example implementation
88115
- Define the stub file's contents
89-
- Within the exercise's `.meta/config.json` file:
90-
- Add the GitHub username of the exercise's authors to the `authors` key
91116

92117
#### Add tests
93118

building/tracks/new/add-initial-exercises.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,21 @@ To make this all a bit more concrete, this is what a sample selection of initial
106106
### Scaffold exercise
107107

108108
Having selected the exercises you want include in your track, the next step is to implement them.
109-
You can quickly scaffold a new Practice Exercise by running the following commands from the track's root directory:
109+
You can quickly scaffold a new Practice Exercise by running the `bin/add-practice-exercise` script ([source](https://github.com/exercism/generic-track/blob/main/bin/add-practice-exercise)) from the track's root directory:
110110

111111
```shell
112-
bin/fetch-configlet
113-
bin/configlet create --practice-exercise <slug>
112+
bin/add-exercise <exercise-slug>
114113
```
115114

116-
For more information, check the [`configlet create` docs](/docs/building/configlet/create)
115+
Optionally, you can also specify the exercise's difficulty (via `-d`) and/or author's GitHub username (via `-a`):
116+
117+
```shell
118+
bin/add-practice-exercise -d 3 -a foobar <exercise-slug>
119+
```
120+
121+
```exercism/note
122+
If you're working on a track repo without this file, feel free to copy them into your repo using the above source link.
123+
```
117124

118125
### Implement exercise
119126

0 commit comments

Comments
 (0)