本文整理汇总了Golang中github.com/hashicorp/otto/helper/schema.FieldData.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang FieldData.Get方法的具体用法?Golang FieldData.Get怎么用?Golang FieldData.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hashicorp/otto/helper/schema.FieldData
的用法示例。
在下文中一共展示了FieldData.Get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: processGo
func (c *customizations) processGo(d *schema.FieldData) error {
c.Opts.Bindata.Context["dev_go_version"] = d.Get("go_version")
// Go is really finicky about the GOPATH. To help make the dev
// environment and build environment more correct, we attempt to
// detect the GOPATH automatically.
//
// We use this GOPATH for example in Vagrant to setup the synced
// folder directly into the GOPATH properly. Magic!
gopathPath := d.Get("import_path").(string)
if gopathPath == "" {
var err error
c.Opts.Ctx.Ui.Header("Detecting application import path for GOPATH...")
gopathPath, err = detectImportPath(c.Opts.Ctx)
if err != nil {
return err
}
}
folderPath := "/vagrant"
if gopathPath != "" {
folderPath = "/opt/gopath/src/" + gopathPath
}
c.Opts.Bindata.Context["import_path"] = gopathPath
c.Opts.Bindata.Context["shared_folder_path"] = folderPath
return nil
}
示例2: processRuby
func (c *customizations) processRuby(d *schema.FieldData) error {
vsn := d.Get("ruby_version")
// If we were asked to detect the version, we attempt to do so.
// If we can't detect it for non-erroneous reasons, we use our default.
if vsn == "detect" {
var err error
c.Opts.Ctx.Ui.Header("Detecting Ruby version to use...")
vsn, err = detectRubyVersionGemfile(filepath.Dir(c.Opts.Ctx.Appfile.Path))
if err != nil {
return err
}
if vsn != "" {
c.Opts.Ctx.Ui.Message(fmt.Sprintf(
"Detected desired Ruby version: %s", vsn))
}
if vsn == "" {
vsn = defaultLatestVersion
c.Opts.Ctx.Ui.Message(fmt.Sprintf(
"No desired Ruby version found! Will use the default: %s", vsn))
}
}
c.Opts.Bindata.Context["ruby_version"] = vsn
return nil
}
示例3: process
func (c *customizations) process(d *schema.FieldData) error {
c.Opts.Bindata.Context["node_version"] = d.Get("node_version")
c.Opts.Bindata.Context["npm_version"] = d.Get("npm_version")
c.Opts.Bindata.Context["port"] = d.Get("port")
c.Opts.Bindata.Context["app_startup_file"] = d.Get("app_startup_file")
c.Opts.Bindata.Context["env_variables"] = d.Get("env_variables")
return nil
}
示例4: processDevDep
func (c *customizations) processDevDep(d *schema.FieldData) error {
cmd, err := c.Opts.Bindata.RenderString(d.Get("run_command").(string))
if err != nil {
return fmt.Errorf("Error processing 'run_command': %s", err)
}
c.Opts.Bindata.Context["dep_run_command"] = cmd
return nil
}
示例5: process
func (c *customizations) process(d *schema.FieldData) error {
image := d.Get("image").(string)
if image == "" {
image = c.Opts.Ctx.Application.Name
}
c.Opts.Bindata.Context["docker_image"] = image
c.Opts.Bindata.Context["run_args"] = d.Get("run_args").(string)
return nil
}
示例6: compileCustomDevDep
func (c *customizations) compileCustomDevDep(d *schema.FieldData) compile.CompileCallback {
vf := d.Get("vagrantfile").(string)
return func() error {
if !filepath.IsAbs(vf) {
vf = filepath.Join(filepath.Dir(c.Opts.Ctx.Appfile.Path), vf)
}
data := c.Opts.Bindata
fragment := data.Context["fragment_path"].(string)
if err := data.RenderReal(fragment, vf); err != nil {
return err
}
return data.RenderAsset(
filepath.Join(c.Opts.Ctx.Dir, "dev", "Vagrantfile"),
"data/dev/Vagrantfile.tpl")
}
}
示例7: processRuby
func (c *customizations) processRuby(d *schema.FieldData) error {
c.Opts.Bindata.Context["ruby_version"] = d.Get("ruby_version")
return nil
}
示例8: processDev
func (c *customizations) processDev(d *schema.FieldData) error {
c.Opts.Bindata.Context["dev_node_version"] = d.Get("node_version")
return nil
}
示例9: processDev
func (c *customizations) processDev(d *schema.FieldData) error {
c.Opts.Bindata.Context["gradle_version"] = d.Get("gradle_version")
c.Opts.Bindata.Context["maven_version"] = d.Get("maven_version")
return nil
}