Example #1
0
File: app.go Project: rowhit/otto
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)
}
Example #2
0
File: app.go Project: mbrodala/otto
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)
}
Example #3
0
File: app.go Project: mbrodala/otto
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{}{},
		},
		ScriptPacks: []*scriptpack.ScriptPack{
			&stdSP.ScriptPack,
			&phpSP.ScriptPack,
		},
		Customization: (&compile.Customization{
			Callback: custom.process,
			Schema: map[string]*schema.FieldSchema{
				"php_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "5.6",
					Description: "PHP version to install",
				},
			},
		}).Merge(compile.VagrantCustomizations(&opts)),
	}

	return compile.App(&opts)
}
Example #4
0
File: app.go Project: mbrodala/otto
func (a *App) Compile(ctx *app.Context) (*app.CompileResult, error) {
	var opts compile.AppOptions
	custom := &customizations{Opts: &opts}
	opts = compile.AppOptions{
		Ctx: ctx,
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context:  map[string]interface{}{},
		},
		ScriptPacks: []*scriptpack.ScriptPack{
			&stdSP.ScriptPack,
			&pythonSP.ScriptPack,
		},
		Customization: (&compile.Customization{
			Callback: custom.process,
			Schema: map[string]*schema.FieldSchema{
				"python_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "2.7",
					Description: "Python version to install",
				},
				"python_entrypoint": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     fmt.Sprintf("%s:app", ctx.Appfile.Application.Name),
					Description: "WSGI entry point",
				},
			},
		}).Merge(compile.VagrantCustomizations(&opts)),
	}

	return compile.App(&opts)
}
Example #5
0
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)
}
Example #6
0
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)
}
Example #7
0
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)
}
Example #8
0
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)
}
Example #9
0
File: app.go Project: mbrodala/otto
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,
		Bindata: &bindata.Data{
			Asset:    Asset,
			AssetDir: AssetDir,
			Context: map[string]interface{}{
				"fragment_path": fragmentPath,
			},
		},
		FoundationConfig: foundation.Config{
			ServiceName: ctx.Application.Name,
		},
		Customization: &compile.Customization{
			Callback: custom.process,
			Schema: map[string]*schema.FieldSchema{
				"dev_vagrantfile": &schema.FieldSchema{
					Type:        schema.TypeString,
					Description: "Path to Vagrantfile",
				},

				"dep_vagrantfile": &schema.FieldSchema{
					Type:        schema.TypeString,
					Description: "Path to Vagrantfile template",
				},

				"packer": &schema.FieldSchema{
					Type:        schema.TypeString,
					Description: "Path to Packer template",
				},

				"terraform": &schema.FieldSchema{
					Type:        schema.TypeString,
					Description: "Path to a Terraform module",
				},
			},
		},
	}

	return compile.App(&opts)
}
Example #10
0
File: app.go Project: mbrodala/otto
// 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{}{},
		},
		ScriptPacks: []*scriptpack.ScriptPack{
			&stdSP.ScriptPack,
			&javaSP.ScriptPack,
		},
		Customization: (&compile.Customization{
			Callback: custom.processDev,
			Schema: map[string]*schema.FieldSchema{
				"gradle_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "2.8",
					Description: "Java version to install",
				},
				"maven_version": &schema.FieldSchema{
					Type:        schema.TypeString,
					Default:     "3.3.9",
					Description: "Maven version to install",
				},
			},
		}).Merge(compile.VagrantCustomizations(&opts)),
	}

	return compile.App(&opts)
}