當前位置: 首頁>>代碼示例>>Golang>>正文


Golang schema.FieldData類代碼示例

本文整理匯總了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;未經允許,請勿轉載。