Skip to content
Snippets Groups Projects
Commit f5a1463b authored by Jessica Yuen's avatar Jessica Yuen
Browse files

Expand non-Jsonnet prototypes using the textmate snippet parser

parent a7791a29
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
"github.com/ksonnet/ksonnet/metadata" "github.com/ksonnet/ksonnet/metadata"
"github.com/ksonnet/ksonnet/prototype" "github.com/ksonnet/ksonnet/prototype"
"github.com/ksonnet/ksonnet/prototype/snippet"
"github.com/ksonnet/ksonnet/prototype/snippet/jsonnet" "github.com/ksonnet/ksonnet/prototype/snippet/jsonnet"
"github.com/ksonnet/ksonnet/utils" "github.com/ksonnet/ksonnet/utils"
"github.com/spf13/cobra" "github.com/spf13/cobra"
...@@ -450,9 +451,11 @@ func expandPrototype(proto *prototype.SpecificationSchema, templateType prototyp ...@@ -450,9 +451,11 @@ func expandPrototype(proto *prototype.SpecificationSchema, templateType prototyp
componentsText = fmt.Sprintf(`components["%s"]`, componentName) componentsText = fmt.Sprintf(`components["%s"]`, componentName)
} }
template = append([]string{`local params = std.extVar("` + metadata.ParamsExtCodeKey + `").` + componentsText + ";"}, template...) template = append([]string{`local params = std.extVar("` + metadata.ParamsExtCodeKey + `").` + componentsText + ";"}, template...)
return jsonnet.Parse(componentName, strings.Join(template, "\n"))
} }
return jsonnet.Parse(componentName, strings.Join(template, "\n")) tm := snippet.Parse(strings.Join(template, "\n"))
return tm.Evaluate(params)
} }
func getParameters(proto *prototype.SpecificationSchema, flags *pflag.FlagSet) (map[string]string, error) { func getParameters(proto *prototype.SpecificationSchema, flags *pflag.FlagSet) (map[string]string, error) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment