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


Golang compile.App函數代碼示例

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