|
| 1 | +# Configlet creating files |
| 2 | + |
| 3 | +When adding a new approach, article or exercise, you'll have to create files with very specific names. |
| 4 | +They also require configuration files to be added or updated. |
| 5 | +With the `create` command, [configlet](/docs/building/configlet) can do all this for you. |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +The `create` command can be used to create the files required to add a new approach, article or exercise, as well as modify any configuration files. |
| 10 | + |
| 11 | +```shell |
| 12 | +configlet [global-options] create [command-options] |
| 13 | + |
| 14 | +Options for create: |
| 15 | + --approach <slug> The slug of the approach |
| 16 | + --article <slug> The slug of the article |
| 17 | + --practice-exercise <slug> The slug of the practice exercise |
| 18 | + --concept-exercise <slug> The slug of the concept exercise |
| 19 | + -e, --exercise <slug> Only operate on this exercise |
| 20 | + -o, --offline Do not update the cached 'problem-specifications' data |
| 21 | +``` |
| 22 | + |
| 23 | +## Create Practice Exercise |
| 24 | + |
| 25 | +To create a practice exercise, one has to specify its slug: |
| 26 | + |
| 27 | +```shell |
| 28 | +configlet create --practice-exercise collatz-conjecture |
| 29 | +``` |
| 30 | + |
| 31 | +This will create the practice exercise's required files, as specified in the [Practice Exercises docs](/docs/building/tracks/practice-exercises). |
| 32 | +If the practice exercise is defined in the [Problem Specifications repo](https://github.com/exercism/problem-specifications/), configlet will sync the docs and metadata from there. |
| 33 | + |
| 34 | +Of course, this is just the first step towards creating an exercise. |
| 35 | +You'll then have to: |
| 36 | + |
| 37 | +- Add tests to the tests file |
| 38 | +- Add an example implementation |
| 39 | +- Define the stub file's contents |
| 40 | +- Within the exercise's `.meta/config.json` file: |
| 41 | + - Add the GitHub username of the exercise's authors to the `authors` key |
| 42 | +- Within the track's `config.json` file: |
| 43 | + - Check/update the exercise's difficulty |
| 44 | + - Add concepts to the `practices` key (only required when the track has concept exercises) |
| 45 | + - Add concepts to the `prerequisites` key (only required when the track has concept exercises) |
| 46 | + |
| 47 | +```exercism/note |
| 48 | +Some tracks have implemented an exercise/test _generator_, which is a tool that can generate the test file's contents based on the exercise's `canonical-data.json` found in the [Problem Specifications repo](https://github.com/exercism/problem-specifications/). |
| 49 | +Make sure to read the track's documentation to see if there is a generator that you can use. |
| 50 | +``` |
| 51 | + |
| 52 | +## Create Concept Exercise |
| 53 | + |
| 54 | +To create a concept exercise, one has to specify its slug: |
| 55 | + |
| 56 | +```shell |
| 57 | +configlet create --concept-exercise bird-watcher |
| 58 | +``` |
| 59 | + |
| 60 | +This will create the concept exercise's required files, as specified in the [Concept Exercises docs](/docs/building/tracks/concept-exercises). |
| 61 | + |
| 62 | +Of course, this is just the first step towards creating an exercise. |
| 63 | +You'll then have to: |
| 64 | + |
| 65 | +- Add tests to the tests file |
| 66 | +- Add an exemplar implementation |
| 67 | +- Define the stub file's contents |
| 68 | +- Write the introduction in `.docs/introduction.md` |
| 69 | +- Write the instructions in `.docs/instructions.md` |
| 70 | +- Within the exercise's `.meta/config.json` file: |
| 71 | + - Add the GitHub username of the exercise's authors to the `authors` key |
| 72 | +- Within the track's `config.json` file: |
| 73 | + - Check/update the exercise's difficulty |
| 74 | + - Add concepts to the `concepts` key |
| 75 | + - Add concepts to the `prerequisites` key |
| 76 | + |
| 77 | +## Create Approach |
| 78 | + |
| 79 | +To create an approach's files, one has to specify the slug of the approach and its exercise: |
| 80 | + |
| 81 | +```shell |
| 82 | +configlet create --approach recursion --exercise collatz-conjecture |
| 83 | +``` |
| 84 | + |
| 85 | +This will create the approach's required files, as specified in the [Approaches docs](/docs/building/tracks/approaches). |
| 86 | + |
| 87 | +## Create Article |
| 88 | + |
| 89 | +To create an article's files, one has to specify the slug of the article and its exercise: |
| 90 | + |
| 91 | +```shell |
| 92 | +configlet create --article performance --exercise collatz-conjecture |
| 93 | +``` |
| 94 | + |
| 95 | +This will create the article's required files, as specified in the [Articles docs](/docs/building/tracks/articles). |
0 commit comments