build

package
v0.0.0-...-0caaa62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 18 Imported by: 0

Documentation

Overview

Package build builds cairo-dock or applets from sources.

Index

Constants

View Source
const (
	// GroupHidden defines a group that should be hidden.
	GroupHidden = "Hidden" // TODO move to config as common
)

Variables

View Source
var (
	// IconMissing defines the optional path to the default icon package emblem.
	//
	IconMissing string

	// CmdSudo defines the command used to get root access for installation.
	//
	CmdSudo = "gksudo"
)
View Source
var (
	// AppletInfo returns an applet location and icon.
	//
	AppletInfo func(cdtype.Logger, string) (dir, icon string)

	// AppletRestart restarts an applet.
	//
	AppletRestart func(name string)

	CloseGui = func() {}
)

Set by the dock or external backend.

Functions

func Init

func Init(log cdtype.Logger, file string, e error)

Init will try to load the build config data from the file, and create it if missing.

func ProcessUptime

func ProcessUptime() (time.Time, error)

ProcessUptime returns the time when the process started.

func ProcessUptimeToSeconds

func ProcessUptimeToSeconds(t time.Time) int

ProcessUptimeToSeconds converts a ProcessUptime to a number of seconds.

Types

type Builder

type Builder interface {
	Label() string
	Icon() string
	Build() error
	SourceDir() string
	SetProgress(func(float64)) // Need values between 0 and 1 in the renderer.
	Progress(float64)
	SetIcon(icon string)
	SetDir(dir string)
}

Builder defines the common builder interface.

func NewBuilder

func NewBuilder(target SourceType, name string, log cdtype.Logger) Builder

NewBuilder creates the target renderer/builder. The name is mandatory for a single applet (internal or not).

type BuilderApplets

type BuilderApplets struct {
	BuilderBase
	BuilderProgress
	MakeFlags string
}

BuilderApplets builds all Cairo-Dock plug-ins.

func (*BuilderApplets) Build

func (build *BuilderApplets) Build() error

Build builds the source code.

func (*BuilderApplets) Icon

func (build *BuilderApplets) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderApplets) Label

func (build *BuilderApplets) Label() string

Label returns the builder label.

type BuilderBase

type BuilderBase struct {
	// contains filtered or unexported fields
}

BuilderBase provides basic informations about a build.

func (*BuilderBase) Icon

func (build *BuilderBase) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderBase) SetDir

func (build *BuilderBase) SetDir(dir string)

SetDir sets the source path for the builder.

func (*BuilderBase) SetIcon

func (build *BuilderBase) SetIcon(icon string)

SetIcon sets the icon name (or path) for the builder.

func (*BuilderBase) SetLogger

func (build *BuilderBase) SetLogger(log cdtype.Logger)

SetLogger sets the builder logger.

func (*BuilderBase) SourceDir

func (build *BuilderBase) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderCompiled

type BuilderCompiled struct {
	BuilderBase
	BuilderProgress
	Module string
}

BuilderCompiled builds external applet that must be compiled (golang or vala). A Makefile with default build will have to be provided in each applet dir.

func (*BuilderCompiled) Build

func (build *BuilderCompiled) Build() error

Build builds the source code.

func (*BuilderCompiled) Label

func (build *BuilderCompiled) Label() string

Label returns the builder label.

type BuilderCore

type BuilderCore struct {
	BuilderBase
	BuilderProgress
	MakeFlags string
}

BuilderCore builds the dock core sources.

func (*BuilderCore) Build

func (build *BuilderCore) Build() error

Build builds the source code.

func (*BuilderCore) Icon

func (build *BuilderCore) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderCore) Label

func (build *BuilderCore) Label() string

Label returns the builder label.

type BuilderGodock

type BuilderGodock struct {
	BuilderBase
	BuilderProgress
	MakeFlags string
}

BuilderGodock builds the new go dock version.

func (*BuilderGodock) Build

func (build *BuilderGodock) Build() error

Build builds the source code.

func (*BuilderGodock) Icon

func (build *BuilderGodock) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderGodock) Label

func (build *BuilderGodock) Label() string

Label returns the builder label.

func (BuilderGodock) SourceDir

func (build BuilderGodock) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderInternal

type BuilderInternal struct {
	BuilderBase
	BuilderProgress
	Module string
}

BuilderInternal builds a Cairo-Dock internal applet. As C applet are provided by the plug-ins package, they are only available after the plug-ins build has been done at least once.

func (*BuilderInternal) Build

func (build *BuilderInternal) Build() error

Build builds the source code.

func (*BuilderInternal) Label

func (build *BuilderInternal) Label() string

Label returns the builder label.

type BuilderNull

type BuilderNull struct {
	BuilderBase
	BuilderProgress
}

BuilderNull is an empty Build for fallback.

func (*BuilderNull) Build

func (build *BuilderNull) Build() error

Build builds the source code.

func (*BuilderNull) Icon

func (build *BuilderNull) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderNull) Label

func (build *BuilderNull) Label() string

Label returns the builder label.

func (*BuilderNull) SourceDir

func (build *BuilderNull) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderProgress

type BuilderProgress struct {
	// contains filtered or unexported fields
}

BuilderProgress provides a callback handler for Builders.

func (*BuilderProgress) Progress

func (build *BuilderProgress) Progress(data float64)

Progress forwards data to the provided callback.

func (*BuilderProgress) SetProgress

func (build *BuilderProgress) SetProgress(f func(float64))

SetProgress sets the callback to forward progress data.

type Config

type Config struct {
	Counter     map[string]Counter `conf:"-"`
	CounterDB   []byte
	TotalUptime int // in seconds

	File string `conf:"-"` // File location, not saved.
	// contains filtered or unexported fields
}

Config defines the options the user can set about the GUI itself. This GUI config page will often be referred as "own config".

var Current Config

Current is the user build config live settings (what is currently active).

func (*Config) IncreaseCounter

func (cs *Config) IncreaseCounter(success bool) error

IncreaseCounter updates the build counter with a new success or fail.

func (*Config) IncreaseCrash

func (cs *Config) IncreaseCrash() error

IncreaseCrash increase the crash counter for the day.

func (*Config) IncreaseUptime

func (cs *Config) IncreaseUptime() error

IncreaseUptime updates the uptime counter with the current process uptime. Use on program close.

func (*Config) Load

func (cs *Config) Load() error

Load loads the own config settings.

func (*Config) Today

func (cs *Config) Today() (Counter, bool)

Today returns today's counters in read only.

type Counter

type Counter struct {
	OK    uint
	Fail  uint
	Crash uint
}

Counter counts builds and crashs.

type SourceType

type SourceType int

SourceType defines the type of a builder.

const (
	TypeNull           SourceType = iota // Do nothing.
	TypeCore                             // Dock core.
	TypeApplets                          // Dock all internal applets (C).
	TypeAppletInternal                   // Dock one internal applet (C).
	TypeAppletScript                     // Dock one external applet script (bash, python, ruby).
	TypeAppletCompiled                   // Dock one external applet compiled (go, mono, vala).
	TypeGodock                           // New dock.
)

Applets build types.

func GetSourceType

func GetSourceType(name string, log cdtype.Logger) SourceType

GetSourceType try to detect an applet type based on its location and content. Could be improved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL