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

Golang compile.App函数代码示例

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

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



在下文中一共展示了App函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	var opts compile.AppOptions
	custom := &customizations{Opts: &opts}
	opts = compile.AppOptions{
		Ctx: ctx,
		Result: &app.CompileResult{
			Version: 1,
		},
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context:  map[string]interface{}{},
		},
		Customizations: []*compile.Customization{
			&compile.Customization{
				Type:     "node",
				Callback: custom.processDev,
				Schema: map[string]*schema.FieldSchema{
					"node_version": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "4.1.0",
						Description: "Node version to install",
					},
				},
			},
		},
	}

	return compile.App(&opts)
}
开发者ID:rowhit,项目名称:otto,代码行数:30,代码来源:app.go


示例2: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	// Get the import path for this
	path, err := goapp.DetectImportPath(ctx)
	if err != nil {
		return nil, err
	}
	if path == "" {
		return nil, fmt.Errorf(
			"Your ScriptPack development folder must be within your GOPATH like\n" +
				"a standard Go project. This is required for the dev environment\n" +
				"to function properly. Please put this folder in a proper GOPATH\n" +
				"location.")
	}

	var opts compile.AppOptions
	opts = compile.AppOptions{
		Ctx: ctx,
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context: map[string]interface{}{
				"working_gopath": path,
			},
		},
	}

	return compile.App(&opts)
}
开发者ID:mbrodala,项目名称:otto,代码行数:28,代码来源:app.go


示例3: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	var opts compile.AppOptions
	custom := &customizations{Opts: &opts}
	opts = compile.AppOptions{
		Ctx: ctx,
		Result: &app.CompileResult{
			Version: 1,
		},
		FoundationConfig: foundation.Config{
			ServiceName: ctx.Application.Name,
		},
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context: map[string]interface{}{
				"dep_binary_path": fmt.Sprintf("/usr/local/bin/%s", ctx.Application.Name),
				"path": map[string]string{
					"guest_working": fmt.Sprintf(
						"/otto-deps/%s-%s",
						ctx.Application.Name,
						ctx.Appfile.ID),
				},
			},
		},
		Customizations: []*compile.Customization{
			&compile.Customization{
				Type:     "go",
				Callback: custom.processGo,
				Schema: map[string]*schema.FieldSchema{
					"go_version": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "1.5",
						Description: "Go version to install",
					},

					"import_path": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "",
						Description: "Go import path for where to put this in the GOPATH",
					},
				},
			},

			&compile.Customization{
				Type:     "dev-dep",
				Callback: custom.processDevDep,
				Schema: map[string]*schema.FieldSchema{
					"run_command": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "{{ dep_binary_path }}",
						Description: "Command to run this app as a dep",
					},
				},
			},
		},
	}

	return compile.App(&opts)
}
开发者ID:ventsislaf,项目名称:otto,代码行数:59,代码来源:app.go


示例4: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	var opts compile.AppOptions
	opts = compile.AppOptions{
		Ctx: ctx,
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context:  map[string]interface{}{},
		},
	}

	return compile.App(&opts)
}
开发者ID:rickard-von-essen,项目名称:otto,代码行数:13,代码来源:app.go


示例5: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	var opts compile.AppOptions
	custom := &customizations{Opts: &opts}
	opts = compile.AppOptions{
		Ctx: ctx,
		Result: &app.CompileResult{
			Version: 1,
		},
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context:  map[string]interface{}{},
		},
		Customization: (&compile.Customization{
			Callback: custom.process,
			Schema: map[string]*schema.FieldSchema{
				"node_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "4.1.0",
					Description: "Node version to install",
				},
				"npm_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "3.3.12",
					Description: "Npm version to install",
				},
				"port": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "8080",
					Description: "Port for Nginx pass through",
				},
				"app_startup_file": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "output/server.js",
					Description: "Application startup file",
				},
				"env_variables": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "",
					Description: "Environment variables to be set in format key=value key=value",
				},
			},
		}).Merge(compile.VagrantCustomizations(&opts)),
	}

	return compile.App(&opts)
}
开发者ID:daptiv,项目名称:otto-plugin-node-server,代码行数:47,代码来源:app.go


示例6: Compile

func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	fragmentPath := filepath.Join(ctx.Dir, "dev-dep", "Vagrantfile.fragment")

	var opts compile.AppOptions
	custom := &customizations{Opts: &opts}
	opts = compile.AppOptions{
		Ctx: ctx,
		FoundationConfig: foundation.Config{
			ServiceName: ctx.Application.Name,
		},
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context: map[string]interface{}{
				"fragment_path": fragmentPath,
				"path": map[string]string{
					"guest_working": fmt.Sprintf(
						"/otto-deps/%s-%s",
						ctx.Application.Name,
						ctx.Appfile.ID),
				},
			},
		},
		Customizations: []*compile.Customization{
			&compile.Customization{
				Type:     "docker",
				Callback: custom.processDocker,
				Schema: map[string]*schema.FieldSchema{
					"image": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "",
						Description: "Image name to run",
					},

					"run_args": &schema.FieldSchema{
						Type:        schema.TypeString,
						Default:     "",
						Description: "Args to pass to `docker run`",
					},
				},
			},
		},
	}

	return compile.App(&opts)
}
开发者ID:nvartolomei,项目名称:otto,代码行数:46,代码来源:app.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang exec.MockRunner类代码示例发布时间:2022-05-23
下一篇:
Golang appfile.File类代码示例发布时间: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