• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang schema.FieldData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/hashicorp/otto/helper/schema.FieldData的典型用法代码示例。如果您正苦于以下问题:Golang FieldData类的具体用法?Golang FieldData怎么用?Golang FieldData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了FieldData类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:nvartolomei,项目名称:otto,代码行数:29,代码来源:customization.go


示例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
}
开发者ID:rowhit,项目名称:otto,代码行数:26,代码来源:customization.go


示例3: processDevDep

func (c *customizations) processDevDep(d *schema.FieldData) error {
	if _, ok := d.GetOk("vagrantfile"); !ok {
		return nil
	}

	c.Opts.Callbacks = append(c.Opts.Callbacks, c.compileCustomDevDep(d))
	return nil
}
开发者ID:rowhit,项目名称:otto,代码行数:8,代码来源:customization.go


示例4: 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
}
开发者ID:daptiv,项目名称:otto-plugin-node-server,代码行数:8,代码来源:customization.go


示例5: 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
}
开发者ID:nvartolomei,项目名称:otto,代码行数:9,代码来源:customization.go


示例6: 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
}
开发者ID:mbrodala,项目名称:otto,代码行数:10,代码来源:customization.go


示例7: processDeploy

func (c *customizations) processDeploy(d *schema.FieldData) error {
	tf, ok := d.GetOk("terraform")
	if !ok {
		return nil
	}

	c.Opts.Bindata.Context["deploy_terraform_path"] = tf.(string)
	c.Opts.Callbacks = append(c.Opts.Callbacks, c.compileCustomDeploy(d))
	return nil
}
开发者ID:rowhit,项目名称:otto,代码行数:10,代码来源:customization.go


示例8: processBuild

func (c *customizations) processBuild(d *schema.FieldData) error {
	p, ok := d.GetOk("packer")
	if !ok {
		return nil
	}

	c.Opts.Bindata.Context["build_packer_path"] = p.(string)
	c.Opts.Callbacks = append(c.Opts.Callbacks, c.compileCustomBuild(d))
	return nil
}
开发者ID:rowhit,项目名称:otto,代码行数:10,代码来源:customization.go


示例9: processDev

func (c *customizations) processDev(d *schema.FieldData) error {
	p, ok := d.GetOk("vagrant")
	if !ok {
		return nil
	}

	c.Opts.Bindata.Context["dev_vagrant_path"] = p.(string)
	c.Opts.Callbacks = append(c.Opts.Callbacks, c.compileCustomDev(d))
	return nil
}
开发者ID:nvartolomei,项目名称:otto,代码行数:10,代码来源:customization.go


示例10: 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")
	}
}
开发者ID:rowhit,项目名称:otto,代码行数:19,代码来源:customization.go


示例11: processRuby

func (c *customizations) processRuby(d *schema.FieldData) error {
	c.Opts.Bindata.Context["ruby_version"] = d.Get("ruby_version")
	return nil
}
开发者ID:nvartolomei,项目名称:otto,代码行数:4,代码来源:customization.go


示例12: processDev

func (c *customizations) processDev(d *schema.FieldData) error {
	c.Opts.Bindata.Context["dev_node_version"] = d.Get("node_version")
	return nil
}
开发者ID:Cbeck527,项目名称:otto,代码行数:4,代码来源:customization.go


示例13: 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
}
开发者ID:mbrodala,项目名称:otto,代码行数:5,代码来源:customization.go



注:本文中的github.com/hashicorp/otto/helper/schema.FieldData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang vagrant.Dev函数代码示例发布时间:2022-05-23
下一篇:
Golang router.Context类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap