-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.go
37 lines (31 loc) · 925 Bytes
/
examples.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package recipeutil
import "github.com/futurice/jalapeno/pkg/recipe"
func CreateExampleRecipe(name string) *recipe.Recipe {
r := recipe.NewRecipe()
variableName := "MY_VAR"
defaultValue := "Hello World!"
r.Metadata.Name = name
r.Metadata.Version = "v0.0.0"
r.Metadata.Description = "Description about what the recipe is used for and what it contains. For example tech stack, cloud environments, tools"
r.Variables = []recipe.Variable{
{Name: variableName, Default: defaultValue},
}
r.Templates = map[string]recipe.File{
"README.md": recipe.NewFile([]byte("{{ .Variables.MY_VAR }}")),
}
r.Tests = []recipe.Test{
{
Name: "defaults",
Values: recipe.VariableValues{variableName: defaultValue},
Files: map[string]recipe.File{
"README.md": recipe.NewFile([]byte(defaultValue)),
},
},
}
return r
}
func CreateExampleTest(name string) recipe.Test {
return recipe.Test{
Name: name,
}
}