Skip to content

Commit 4d7bcf3

Browse files
Document configlet create (#485)
* configlet: document `create` command * Add notes about using '
1 parent 2b372fe commit 4d7bcf3

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed

building/configlet/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Tests in this file are identified by their UUID and each test has a boolean valu
3636

3737
You can find the details about how to sync the different parts of an exercise [here](/docs/building/configlet/sync).
3838

39+
## Create files
40+
41+
Configlet can be used to quickly scaffold files for a new approach, article or exercise.
42+
43+
You can learn more about how to create these files [here](/docs/building/configlet/create).
44+
3945
## Generating UUIDs
4046

4147
Exercises, tracks and concepts are identified by a UUID.

building/configlet/create.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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).

building/tracks/concept-exercises.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
The concepts taught by the concept exercises form a _syllabus_.
55
For more information on how to design a syllabus, check the [syllabus documentation](/docs/building/tracks/syllabus).
66

7+
````exercism/note
8+
You can quickly scaffold a new Concept Exercise by running the following commands from the track's root directory:
9+
10+
```shell
11+
bin/fetch-configlet
12+
bin/configlet create --concept-exercise <slug>
13+
```
14+
15+
For more information, check the [`configlet create` docs](/docs/building/configlet/create)
16+
````
17+
718
## Metadata
819

920
Concept Exercise metadata is defined in the `exercises.concept` key in the [config.json file](/docs/building/tracks/config-json#concept-exercises). The metadata defines the exercise's UUID, slug and more.

building/tracks/practice-exercises.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ Interested in adding your first Practice Exercise to a track? Watch our walkthro
66

77
[video:vimeo/906101866?h=2954ad331e]()
88

9+
````exercism/note
10+
You can quickly scaffold a new Practice Exercise by running the following commands from the track's root directory:
11+
12+
```shell
13+
bin/fetch-configlet
14+
bin/configlet create --practice-exercise <slug>
15+
```
16+
17+
For more information, check the [`configlet create` docs](/docs/building/configlet/create)
18+
````
19+
920
## Metadata
1021

1122
Practice Exercise metadata is defined in the `exercises.practice` key in the [config.json file](/docs/building/tracks/config-json). The metadata defines the exercise's UUID, slug and more.

0 commit comments

Comments
 (0)