summaryrefslogtreecommitdiff
path: root/gomplate.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-06-08 20:41:41 -0400
committerDave Henderson <dhenderson@gmail.com>2017-06-08 20:41:41 -0400
commitb580bba092120362867f37a5a691dc8a1fd00d7c (patch)
tree3ee722f234107f7a2d5a1054f991ecae0d7d06af /gomplate.go
parent3837f4874bf8f690bc97d8f83a957804c7ce6783 (diff)
Namespacing the AWS funcs
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'gomplate.go')
-rw-r--r--gomplate.go51
1 files changed, 1 insertions, 50 deletions
diff --git a/gomplate.go b/gomplate.go
index f02c6f14..71530368 100644
--- a/gomplate.go
+++ b/gomplate.go
@@ -3,11 +3,7 @@ package main
import (
"io"
"log"
- "net/url"
- "strings"
"text/template"
-
- "github.com/hairyhenderson/gomplate/aws"
)
func (g *Gomplate) createTemplate() *template.Template {
@@ -36,55 +32,10 @@ func (g *Gomplate) RunTemplate(text string, out io.Writer) {
// NewGomplate -
func NewGomplate(data *Data, leftDelim, rightDelim string) *Gomplate {
- env := &Env{}
- typeconv := &TypeConv{}
- stringfunc := &stringFunc{}
- ec2meta := aws.NewEc2Meta()
- ec2info := aws.NewEc2Info()
return &Gomplate{
leftDelim: leftDelim,
rightDelim: rightDelim,
- funcMap: template.FuncMap{
- "getenv": env.Getenv,
- "bool": typeconv.Bool,
- "has": typeconv.Has,
- "json": typeconv.JSON,
- "jsonArray": typeconv.JSONArray,
- "yaml": typeconv.YAML,
- "yamlArray": typeconv.YAMLArray,
- "toml": typeconv.TOML,
- "csv": typeconv.CSV,
- "csvByRow": typeconv.CSVByRow,
- "csvByColumn": typeconv.CSVByColumn,
- "slice": typeconv.Slice,
- "indent": typeconv.indent,
- "join": typeconv.Join,
- "toJSON": typeconv.ToJSON,
- "toJSONPretty": typeconv.toJSONPretty,
- "toYAML": typeconv.ToYAML,
- "toTOML": typeconv.ToTOML,
- "toCSV": typeconv.ToCSV,
- "ec2meta": ec2meta.Meta,
- "ec2dynamic": ec2meta.Dynamic,
- "ec2tag": ec2info.Tag,
- "ec2region": ec2meta.Region,
- "contains": strings.Contains,
- "hasPrefix": strings.HasPrefix,
- "hasSuffix": strings.HasSuffix,
- "replaceAll": stringfunc.replaceAll,
- "split": strings.Split,
- "splitN": strings.SplitN,
- "title": strings.Title,
- "toUpper": strings.ToUpper,
- "toLower": strings.ToLower,
- "trim": strings.Trim,
- "trimSpace": strings.TrimSpace,
- "urlParse": url.Parse,
- "datasource": data.Datasource,
- "ds": data.Datasource,
- "datasourceExists": data.DatasourceExists,
- "include": data.include,
- },
+ funcMap: initFuncs(data),
}
}