Ejemplo n.º 1
0
Archivo: app.go Proyecto: rowhit/otto
func (a *App) Dev(ctx *app.Context) error {
	var layered *vagrant.Layered

	// We only setup a layered environment if we've recompiled since
	// version 0. If we're still at version 0 then we have to use the
	// non-layered dev environment.
	if ctx.CompileResult.Version > 0 {
		// Read the go version, since we use that for our layer
		version, err := oneline.Read(filepath.Join(ctx.Dir, "dev", "node_version"))
		if err != nil {
			return err
		}

		// Setup layers
		layered, err = vagrant.DevLayered(ctx, []*vagrant.Layer{
			&vagrant.Layer{
				ID:          fmt.Sprintf("node%s", version),
				Vagrantfile: filepath.Join(ctx.Dir, "dev", "layer-base", "Vagrantfile"),
			},
		})
		if err != nil {
			return err
		}
	}

	// Build the actual development environment
	return vagrant.Dev(&vagrant.DevOptions{
		Instructions: strings.TrimSpace(devInstructions),
		Layer:        layered,
	}).Route(ctx)
}
Ejemplo n.º 2
0
Archivo: app.go Proyecto: mbrodala/otto
func (a *App) Dev(ctx *app.Context) error {
	r := vagrant.Dev(&vagrant.DevOptions{
		Instructions: strings.TrimSpace(devInstructions),
	})

	// Add our customer actions
	r.Actions["scriptpack-rebuild"] = &router.SimpleAction{
		ExecuteFunc:  a.actionRebuild,
		SynopsisText: actionRebuildSyn,
		HelpText:     strings.TrimSpace(actionRebuildHelp),
	}

	r.Actions["scriptpack-test"] = &router.SimpleAction{
		ExecuteFunc:  a.actionTest,
		SynopsisText: actionTestSyn,
		HelpText:     strings.TrimSpace(actionTestHelp),
	}

	return r.Route(ctx)
}
Ejemplo n.º 3
0
Archivo: app.go Proyecto: mbrodala/otto
func (a *App) Dev(ctx *app.Context) error {
	// Determine if we have a Vagrant path set...
	instructions := devInstructionsCustom
	path := filepath.Join(ctx.Dir, "dev", "vagrant_path")
	if _, err := os.Stat(path); err != nil {
		if !os.IsNotExist(err) {
			return err
		}

		path = ""
	}
	if path != "" {
		var err error
		path, err = oneline.Read(path)
		if err != nil {
			return fmt.Errorf(
				"Error reading the Vagrant directory: %s\n\n"+
					"An Otto recompile with `otto compile` usually fixes this.",
				err)
		}
	}

	if path == "" {
		// Determine if we have our own Vagrantfile
		path = filepath.Join(ctx.Dir, "dev", "Vagrantfile")
		if _, err := os.Stat(path); err != nil {
			if os.IsNotExist(err) {
				return errors.New(strings.TrimSpace(errVagrantNotSet))
			}

			return err
		}

		instructions = devInstructionsDevDep
	}

	return vagrant.Dev(&vagrant.DevOptions{
		Dir:          filepath.Dir(path),
		Instructions: strings.TrimSpace(instructions),
	}).Route(ctx)
}
Ejemplo n.º 4
0
Archivo: app.go Proyecto: mbrodala/otto
func (a *App) Dev(ctx *app.Context) error {
	var layered *vagrant.Layered

	// We only setup a layered environment if we've recompiled since
	// version 0. If we're still at version 0 then we have to use the
	// non-layered dev environment.
	if ctx.CompileResult.Version > 0 {
		// Setup layers
		var err error
		layered, err = vagrant.DevLayered(ctx, []*vagrant.Layer{})
		if err != nil {
			return err
		}
	}

	// Build the actual development environment
	return vagrant.Dev(&vagrant.DevOptions{
		Instructions: strings.TrimSpace(devInstructions),
		Layer:        layered,
	}).Route(ctx)
}
Ejemplo n.º 5
0
Archivo: app.go Proyecto: mbrodala/otto
func (a *App) Dev(ctx *app.Context) error {
	// Read the go version, since we use that for our layer
	version, err := oneline.Read(filepath.Join(ctx.Dir, "dev", "python_version"))
	if err != nil {
		return err
	}

	// Setup layers
	layered, err := vagrant.DevLayered(ctx, []*vagrant.Layer{
		&vagrant.Layer{
			ID:          fmt.Sprintf("python%s", version),
			Vagrantfile: filepath.Join(ctx.Dir, "dev", "layer-base", "Vagrantfile"),
		},
	})
	if err != nil {
		return err
	}

	// Build the actual development environment
	return vagrant.Dev(&vagrant.DevOptions{
		Instructions: strings.TrimSpace(devInstructions),
		Layer:        layered,
	}).Route(ctx)
}
Ejemplo n.º 6
0
func (a *App) Dev(ctx *app.Context) error {
	return vagrant.Dev(&vagrant.DevOptions{
		Instructions: strings.TrimSpace(devInstructions),
	}).Route(ctx)
}