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

Add script to add practice exercise #565

Merged
merged 1 commit into from
Aug 20, 2024
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
8 changes: 5 additions & 3 deletions building/tooling/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ A very helpful command-line tool is [hyperfine](https://github.com/sharkdp/hyper

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

1. `./bin/benchmark.sh`: benchmark the track tooling code ([source code](https://github.com/exercism/generic-test-runner/blob/a6886f4d84d2a2030f766a658c334bbfbe97b79c/bin/benchmark.sh))
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))
1. `./bin/benchmark.sh`: benchmark the track tooling code ([source code](https://github.com/exercism/generic-test-runner/blob/main/bin/benchmark.sh))
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))

If you're working on a track tooling repo without these files, feel free to copy them into your repo.
```exercism/note
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.
```

```exercism/caution
Benchmarking scripts can help estimate the tooling's performance.
Expand Down
29 changes: 27 additions & 2 deletions building/tracks/new/add-first-exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,40 @@ bin/fetch-configlet
bin/configlet create --practice-exercise hello-world
```

### Set author

To have the website list you as the exercise's author, follow these steps:

Within the exercise's `.meta/config.json` file:

- Add your GitHub username to the `authors` key

For this to work, you'll need link your Exercism account to GitHub.
You can do this on the website in the [Settings page's Integrations section](https://exercism.org/settings/integrations).

```exercism/note
Exercise authors are also awarded [reputation](/docs/using/product/reputation)
```

### Use script

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:

```shell
bin/add-exercise -a <github_username> two-fer
```

```exercism/note
If you're working on a track repo without this file, feel free to copy them into your repo using the above source link.
```

### Implement exercise

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

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

#### Add tests

Expand Down
15 changes: 11 additions & 4 deletions building/tracks/new/add-initial-exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,21 @@ To make this all a bit more concrete, this is what a sample selection of initial
### Scaffold exercise

Having selected the exercises you want include in your track, the next step is to implement them.
You can quickly scaffold a new Practice Exercise by running the following commands from the track's root directory:
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:

```shell
bin/fetch-configlet
bin/configlet create --practice-exercise <slug>
bin/add-exercise <exercise-slug>
```

For more information, check the [`configlet create` docs](/docs/building/configlet/create)
Optionally, you can also specify the exercise's difficulty (via `-d`) and/or author's GitHub username (via `-a`):

```shell
bin/add-practice-exercise -d 3 -a foobar <exercise-slug>
```

```exercism/note
If you're working on a track repo without this file, feel free to copy them into your repo using the above source link.
```

### Implement exercise

Expand Down