-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
138 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ title: API Reference | |
--- | ||
{{- end}} | ||
|
||
{{ template "recipe-schema" .RecipeSchema }} | ||
{{ template "schema" . }} |
47 changes: 27 additions & 20 deletions
47
cmd/docs/templates/recipe-schema.tmpl → cmd/docs/templates/schema.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
{{- define "recipe-schema" }} | ||
{{- define "schema" }} | ||
## Recipe schema (`recipe.yml`) | ||
|
||
| Attribute | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| `apiVersion` | `string` | `v1` | Version of the recipe metadata API schema. Currently should have value "v1" | | ||
| `name` | `string` | | Name of the recipe | | ||
| `version` | `string` | | Version of the recipe. Must be valid [semver](https://semver.org/) | | ||
| `apiVersion` | `string` | `v1` | Version of the recipe metadata API schema. Currently should have value "v1". | | ||
| `name` | `string` | | Name of the recipe. | | ||
| `version` | `string` | | Version of the recipe. Must be valid [semver](https://semver.org/). | | ||
| `description` | `string` | | Description of what the recipe does | | ||
| `sources` | `[]string` | | A list of URLs to source code for this recipe | | ||
| `initHelp` | `string` | | A message which will be showed to an user after a succesful recipe execution. Can be used to guide the user what should be done next in the project directory | | ||
| `ignorePatterns` | `[]string` | | Glob patterns for ignoring generated files from future recipe upgrades. Ignored files will not be regenerated even if their templates change in future versions of the recipe | | ||
| `vars` | `[]Variable` | | An array of variables which can be used in templates | | ||
| `sources` | `[]string` | | A list of URLs to source code for this recipe. | | ||
| `initHelp` | `string` | | A message which will be showed to an user after a succesful recipe execution. Can be used to guide the user what should be done next in the project directory. | | ||
| `ignorePatterns` | `[]string` | | Glob patterns for ignoring generated files from future recipe upgrades. Ignored files will not be regenerated even if their templates change in future versions of the recipe. | | ||
| `vars` | `[]Variable` | | An array of variables which can be used in templates. | | ||
|
||
### Variable | ||
|
||
| Attribute | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| `name` | `string` | | The name of the variable. It is also used as unique identifier | | ||
| `description` | `string` | | Description of the variable. Will be shown to the user when "show help" is activated | | ||
| `default` | `string` | | Default value of the variable | | ||
| `confirm` | `bool` | `false` | If set to true, the prompt will be yes/no question, and the value type will be boolean | | ||
| `optional` | `bool` | `false` | If set to true, the variable can be left empty | | ||
| `options` | `[]string` | | The user selects the value from a list of options | | ||
| `validators` | `[]Validator` | | Validators for the variable | | ||
| `if` | `string` | | Makes the variable conditional based on the result of the expression. The result of the evaluation needs to be a boolean value. Uses https://github.com/antonmedv/expr | | ||
| `columns` | `[]string` | | Set the variable as a table type with columns defined by this property | | ||
| `name` | `string` | | The name of the variable. It is also used as unique identifier. | | ||
| `description` | `string` | | Description of the variable. Will be shown to the user when "show help" is activated. | | ||
| `default` | `string` | | Default value of the variable. | | ||
| `confirm` | `bool` | `false` | If set to true, the prompt will be yes/no question, and the value type will be boolean. | | ||
| `optional` | `bool` | `false` | If set to true, the variable can be left empty. | | ||
| `options` | `[]string` | | The user selects the value from a list of options. | | ||
| `validators` | `[]Validator` | | Validators for the variable. | | ||
| `if` | `string` | | Makes the variable conditional based on the result of the expression. The result of the evaluation needs to be a boolean value. Uses https://github.com/antonmedv/expr. | | ||
| `columns` | `[]string` | | Set the variable as a table type with columns defined by this property. | | ||
|
||
### Validator | ||
|
||
| Attribute | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| `pattern` | `string` | | Regular expression pattern to match the input against | | ||
| `help` | `string` | | If the regular expression validation fails, this help message will be shown to the user | | ||
| `column` | `string` | | Apply the validator to a column if the variable type is table | | ||
| `pattern` | `string` | | Regular expression pattern to match the input against. | | ||
| `help` | `string` | | If the regular expression validation fails, this help message will be shown to the user. | | ||
| `column` | `string` | | Apply the validator to a column if the variable type is table. | | ||
|
||
## Test schema (`test.yml`) | ||
|
||
| Attribute | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| `values` | `map[string]any` | | Values to use to render the recipe templates. Map key is the name of the variable and value is the variable value. | | ||
| `ignoreExtraFiles` | `bool` | | If true, test will pass even though templates generated more files than the test specifies. This is useful when creating specific test cases for large recipes. | | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ slug: /usage/ | |
title: Usage | ||
--- | ||
|
||
# Usage | ||
# Usage [WIP] | ||
|
||
## Getting started | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: v1 | ||
name: minimal | ||
version: v0.0.1 | ||
version: v0.0.0 | ||
description: Minimal recipe which just creates a README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v1 | ||
name: with-tests | ||
version: v0.0.0 | ||
description: This recipe has tests which you can run with `jalapeno test .` | ||
vars: | ||
- name: MY_VAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.Variables.MY_VAR is {{ .Variables.MY_VAR }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.Variables.MY_VAR is bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
values: | ||
MY_VAR: bar | ||
ignoreExtraFiles: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.Variables.MY_VAR is foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
values: | ||
MY_VAR: foo | ||
ignoreExtraFiles: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters