Ejemplo n.º 1
0
Archivo: build.go Proyecto: sqp/godock
// restartTarget restarts the current build target if needed,
// with everything necessary (like the dock for an internal app).
//
func (app *Applet) restartTarget() {
	if !app.conf.BuildReload {
		return
	}
	target := app.conf.BuildTargets[app.targetID]
	app.Log().Info("restart", target)
	switch build.GetSourceType(target, app.Log()) {
	case build.TypeAppletScript, build.TypeAppletCompiled:
		if target == app.Name() { // Don't eat the chicken, or you won't have any more eggs.
			app.Log().ExecAsync("make", "reload")

		} else {
			build.AppletRestart(target)
		}

	case build.TypeGodock:
		build.CloseGui()
		go app.Log().Err(dlogbus.Action((*dlogbus.Client).Restart), "restart") // No need to wait an answer, it blocks.

	default:
		func() {
			app.Log().ExecAsync("cdc", "restart")
		}()

	}
}
Ejemplo n.º 2
0
Archivo: build.go Proyecto: sqp/godock
// setBuildTarget creates the target renderer/builder.
//
func (app *Applet) setBuildTarget() {
	if !app.conf.UserMode { // Tester mode.
		app.target = &build.BuilderNull{}

	} else {
		var (
			name       = app.conf.BuildTargets[app.targetID]
			sourceType = build.GetSourceType(name, app.Log())
		)
		app.target = app.newBuilder(sourceType, name)
		app.Log().Debug("setBuildTarget", app.target.Label())
	}

	// Delayed display of emblem. 5ms seemed to be enough but 500 should do the job.
	go func() { time.Sleep(500 * time.Millisecond); app.showTarget() }()
}