Skip to content

Commit 55dd9a4

Browse files
Expand docs about adding hello-world to a new track (#388)
* Expand docs about adding hello-world to a new track Most people implementing a new track are unfamiliar with all the moving pieces of a track and Exercism's tooling. This adds a bit more hand-holding so that new volunteers don't need to trawl through the reference documents and draw their own conclusions about how to proceed. * Improve configlet workflow suggestion to work around bug Co-authored-by: Erik Schierboom <[email protected]> * Tweak wording to clarify intent Co-authored-by: Erik Schierboom <[email protected]> * Fix punctuation Co-authored-by: Erik Schierboom <[email protected]> * Fix formatting Co-authored-by: Erik Schierboom <[email protected]> Co-authored-by: Erik Schierboom <[email protected]>
1 parent a0aa118 commit 55dd9a4

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

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

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ This is also probably going to be the hardest part of getting the track reposito
1414

1515
## Implementing the exercise
1616

17-
To implement the "Hello, World!" exercise, you'll need to create several files.
18-
Which files exactly is described in the [Practice Exercises documentation](/docs/building/tracks/practice-exercises).
19-
2017
The "Hello, World!" exercise has some special rules applied to it:
2118

2219
- It is always the first exercise in a track
@@ -25,3 +22,53 @@ The "Hello, World!" exercise has some special rules applied to it:
2522
- The stub file contains an almost-working implementation, but instead of "Hello, World!" it uses "Goodbye, Mars!"
2623
- It has no `prerequisites`
2724
- It has no `practices`
25+
26+
### Updating the config
27+
28+
Start by adding an entry to the `exercises.practice` array in the top-level `config.json` file.
29+
30+
```
31+
{
32+
"exercises": {
33+
"practice": [
34+
{
35+
"uuid": "",
36+
"slug": "hello-world",
37+
"name": "Hello World",
38+
"practices": [],
39+
"prerequisites": [],
40+
"difficulty": 1
41+
}
42+
]
43+
}
44+
}
45+
```
46+
47+
You can use the [Configlet][configlet] tool to get a UUID.
48+
Download Configlet by running `bin/fetch-configlet` from the root of the repository.
49+
Then generate a UUID using the `bin/configlet uuid` command.
50+
51+
### Generating required files
52+
53+
To implement the "Hello, World!" exercise, you'll need to create several files.
54+
Which files exactly is described in the [Practice Exercises documentation](/docs/building/tracks/practice-exercises).
55+
56+
Most of the files can be added automatically by running Configlet's `sync` command:
57+
58+
```
59+
bin/configlet sync --update --yes --docs --metadata --exercise hello-world
60+
bin/configlet sync --update --tests include --exercise hello-world
61+
```
62+
63+
In addition to the generated files, you will to create a test suite, a stub solution that serves as the starting point for the student, and a sample solution that passes all the tests to verify it is possible to solve the exercise (CI will verify this).
64+
65+
In order to create these files, you need to make some decisions about filenames and file paths.
66+
The rule of thumb is to use names that are idiomatic for the language, and where there are no strong preferences prefer shallower directory structures.
67+
The sample solution will need to be identifiable by the CI script, so it's advisable to choose a generic basename that all exercises can use, e.g. `example`, `sample`, or `reference-solution`.
68+
69+
### Configuring the exercise
70+
71+
One you've decided on the filenames and paths, edit the `exercises/practice/hello-world/.meta/config.json` file to reflect those choices.
72+
Also add your GitHub username to the `"authors"` array.
73+
74+
[configlet]: /docs/building/configlet

0 commit comments

Comments
 (0)