Skip to content

Commit 86c5a2a

Browse files
authored
Merge pull request #12 from coderoad/feature/test-output
update docs
2 parents b135dd9 + dbe1653 commit 86c5a2a

File tree

2 files changed

+34
-39
lines changed

2 files changed

+34
-39
lines changed

README.md

+29-33
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,46 @@ npm install -g @coderoad/cli
1717

1818
## Create
1919

20+
Create templates files for building a new tutorial.
21+
2022
```shell
2123
coderoad create
2224
```
2325

24-
Create templates files in the current folder for the content and setup files.
26+
Templates for specific coding languages to come.
2527

2628
## Build
2729

28-
```text
29-
$ coderoad build [options]
30-
31-
options:
30+
Build the configuration file to be used by the extension to run the tutorial.
3231

33-
-g, --git Tutorial's remote git address. Either --git or --dir should be provided.
34-
-d, --dir Tutorial's local directory. Either --git or --dir should be provided.
35-
-c, --code Branch that contains the code.
36-
-s, --setup Branch that contains the TUTORIAL.md and coderoad.yaml files.
37-
-o, --output (Optional) Save the configuration in the output file.
38-
Log into the console if not set
39-
-h, --help (Optional) Show the help message
32+
```shell
33+
coderoad build
4034
```
4135

42-
Build the configuration file to be used by the extension to run the tutorial. The configuration file is created by matching the `level` and `step` ids between the `TUTORIAL.md` and `coderoad.yaml` files against git commit messages with the same ids. For example:
36+
Defaults assume:
37+
38+
- a `TUTORIAL.md` markdown file (change with `--markdown OTHER.md`)
39+
- a `coderoad.yaml` file (change with `--yaml other.yaml`)
40+
- an output file of `tutorial.json` (change with `--output other.json`)
41+
42+
The configuration file is created by matching the `level` and `step` ids between the `TUTORIAL.md` and `coderoad.yaml` files against git commit messages with the same ids. For example:
4343

4444
**TUTORIAL.md**
4545

4646
```markdown
47-
...
47+
# Tutorial Title
4848

49-
## L10 This is a level with id = 10
49+
Tutorial description.
50+
51+
## L1 This is a level with id = 1
5052

5153
This level has two steps...
5254

53-
### L10S1 First step
55+
### L1S1 First step
5456

55-
The first step with id L10S1. The Step id should start with the level id.
57+
The first step with id L1S1. The Step id should start with the level id.
5658

57-
### L10S2 The second step
59+
### L1S2 The second step
5860

5961
The second step...
6062
```
@@ -64,14 +66,13 @@ The second step...
6466
```yaml
6567
---
6668
levels:
67-
- id: L10
69+
- id: L1
6870
config: {}
6971
steps:
70-
- id: L10S1
72+
- id: L1S1
7173
setup:
7274
files:
7375
- package.json
74-
commits: []
7576
watchers:
7677
- package.json
7778
- node_modules/express
@@ -80,20 +81,17 @@ levels:
8081
solution:
8182
files:
8283
- package.json
83-
commits: []
8484
commands:
8585
- npm install
86-
- id: L10S2
86+
- id: L1S2
8787
setup:
8888
files:
8989
- src/server.js
90-
commits: []
9190
commands:
9291
- npm install
9392
solution:
9493
files:
9594
- src/server.js
96-
commits: []
9795
```
9896
9997
... and the commit messages
@@ -103,25 +101,23 @@ commit 8e0e3a42ae565050181fdb68298114df21467a74 (HEAD -> v2, origin/v2)
103101
Author: creator <[email protected]>
104102
Date: Sun May 3 16:16:01 2020 -0700
105103

106-
L10S1Q setup step 1 for level 2
104+
L1S1Q setup step 1 for level 1
107105

108106
commit 9499611fc9b311040dcabaf2d98439fc0c356cc9
109107
Author: creator <[email protected]>
110108
Date: Sun May 3 16:13:37 2020 -0700
111109

112-
L10S2A checkout solution for Level 1, step 2
110+
L1S2A checkout solution for level 1, step 2
113111

114112
commit c5c62041282579b495d3589b2eb1fdda2bcd7155
115113
Author: creator <[email protected]>
116114
Date: Sun May 3 16:11:42 2020 -0700
117115

118-
L10S2Q setup level 1, step 2
116+
L1S2Q setup level 1, step 2
119117
```
120118
121-
Note that the step `L10S2` has two commits, one with the suffix `Q` and another one with `A`. The suffixes mean `Question` and `Answer`, respectively.
122-
123-
Steps defined as questions are **required** as they are meant to set the task to be executed by the student. The answer is optional and should be used when a commit must be loaded to verify the student's solution. If there is no need to load commits for `A` steps, the `commits` key should be removed from the `coderoad.yaml` file for that step.
119+
Note that the step `L1S2` has two commits, one with the suffix `Q` and another one with `A`. The suffixes mean `Question` and `Answer`, respectively, and refer to the unit tests and the commit that makes them pass.
124120

125-
**IMPORTANT**
121+
Steps defined as questions are **required** as they are meant to set the task to be executed by the student. The answer is optional and should be used when a commit must be loaded to verify the student's solution.
126122

127-
Only the most recent commit is evaluated for each level/step id.
123+
If there are multiple commits for a level or step, they are captured in order.

src/build.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ type BuildArgs = {
2727
const parseArgs = (args: string[]): BuildArgs => {
2828
// default .
2929
const dir = args[0] || ".";
30-
// -o --output - default coderoad.json
31-
const output =
32-
getArg(args, { name: "output", alias: "o" }) || "coderoad.json";
30+
3331
// -m --markdown - default TUTORIAL.md
3432
const markdown =
3533
getArg(args, { name: "markdown", alias: "m" }) || "TUTORIAL.md";
3634
// -y --yaml - default coderoad-config.yml
37-
const yaml =
38-
getArg(args, { name: "coderoad-config.yml", alias: "y" }) ||
39-
"coderoad-config.yml";
35+
const yaml = getArg(args, { name: "yaml", alias: "y" }) || "coderoad.yaml";
36+
// -o --output - default coderoad.json
37+
const output =
38+
getArg(args, { name: "output", alias: "o" }) || "tutorial.json";
4039

4140
return {
4241
dir,

0 commit comments

Comments
 (0)