configure

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigFileName is the main config json file name.
	DefaultConfigFileName = "config.json"
	// DefaultPath this is the default path to store gocd configurations
	DefaultPath = "/.contxt/"
	// DefaultWorkspace this is the main configuration workspace
	DefaultWorkspace = "default"
	// MirrorPath path for local mirror
	MirrorPath = "mirror/"
)

Variables

This section is empty.

Functions

func AddPath

func AddPath(path string)

AddPath adding a path if they not already exists

func ChangeWorkspace

func ChangeWorkspace(workspace string, oldspace func(string) bool, newspace func(string))

ChangeWorkspace changing workspace

func ClearPaths

func ClearPaths()

ClearPaths removes all paths from current Workspace

func DisplayWorkSpaces

func DisplayWorkSpaces()

DisplayWorkSpaces prints out all workspaces

func GetBuild

func GetBuild() string

GetBuild returns Build time as build NO

func GetVersion

func GetVersion() string

GetVersion deleivers the current build version

func InitConfig

func InitConfig() error

InitConfig initilize the configuration files

func ListWorkSpaces

func ListWorkSpaces() []string

ListWorkSpaces : list all existing workspaces

func PathExists

func PathExists(pathSearch string) bool

PathExists checks if this path is stored in current Workspace

func PathMeightPartOfWs

func PathMeightPartOfWs(pathSearch string) bool

PathMeightPartOfWs checks if the path meight be a part of this workspace

func PathWorker

func PathWorker(callback func(int, string))

PathWorker executes a callback function in a path

func RemovePath

func RemovePath(path string) bool

RemovePath removes a path from current set. returns true is path was found and removed

func RemoveWorkspace

func RemoveWorkspace(name string)

RemoveWorkspace removes a workspace

func SaveConfiguration

func SaveConfiguration(config Configuration, path string)

SaveConfiguration : stores configuration in given path

func SaveDefaultConfiguration

func SaveDefaultConfiguration(workSpaceConfigUpdate bool)

SaveDefaultConfiguration stores the current configuration as default

func ShowPaths

func ShowPaths(current string) int

ShowPaths : display all stored paths in the workspace

func WorkSpaces

func WorkSpaces(callback func(string))

WorkSpaces handler to iterate all workspaces

Types

type Action

type Action struct {
	Target  string   `yaml:"target"`
	Stopall bool     `yaml:"stopall"`
	Script  []string `yaml:"script"`
}

Action defines what should happens Next.

type Autorun

type Autorun struct {
	// this target will be executed if to this workspace was changed
	Onenter string `yaml:"onenter"`

	// this target will be executed if we changing to another workspace
	// so we leaving the current workspace
	// can be used for cleanup ...as a example
	Onleave string `yaml:"onleave"`
}

Autorun defines the targets they have to be executed if a special event is triggered

type CommandLine

type CommandLine struct {
	Require            RequireCheck
	Command            string
	Params             string
	Comment            string
	StopOnError        bool
	StopOnOutCountLess int
	StopOnOutCountMore int
	StopOnOutContains  string
	TraceOutput        bool
}

CommandLine defines a line of commands that can be executed

type Config

type Config struct {
	Sequencially bool              `yaml:"sequencially"`
	Coloroff     bool              `yaml:"coloroff"`
	Loglevel     string            `yaml:"loglevel"`
	Variables    map[string]string `yaml:"variables,omitempty"`
	Autorun      Autorun           `yaml:"autorun"`
	Imports      []string          `yaml:"imports"`
}

Config is the main Configuration part of the Template.

type Configuration

type Configuration struct {
	CurrentSet string
	Paths      []string
}

Configuration includes all paths for the current workspace

var UsedConfig Configuration

UsedConfig is the the current used configuration

type ExecuteDefinition

type ExecuteDefinition struct {
	TestScript  []CommandLine
	InitScript  []CommandLine
	CleanScript []CommandLine
	Script      []CommandLine
}

ExecuteDefinition Defines the structure of a .execute file that defines commands they have to executed

type IncludePaths

type IncludePaths struct {
	Include struct {
		Basedir bool     `yaml:"basedir"`
		Folders []string `yaml:"folders"`
	} `yaml:"include"`
}

IncludePaths are files the defines how variables should be parsed. they indludes folders they have to be parsed first so they contents can be sued to proceeed with test/template. otherwise the yaml file is not readable

type Listener

type Listener struct {
	Trigger Trigger `yaml:"trigger"`
	Action  Action  `yaml:"action"`
}

Listener are used for watching events and triggers an action if a event happens

type Options

type Options struct {
	IgnoreCmdError bool     `yaml:"ignoreCmdError"`
	Format         string   `yaml:"format"`
	Stickcursor    bool     `yaml:"stickcursor"`
	Colorcode      string   `yaml:"colorcode"`
	Bgcolorcode    string   `yaml:"bgcolorcode"`
	Panelsize      int      `yaml:"panelsize"`
	Displaycmd     bool     `yaml:"displaycmd"`
	Hideout        bool     `yaml:"hideout"`
	Invisible      bool     `yaml:"invisible"`
	Maincmd        string   `yaml:"maincmd"`
	Mainparams     []string `yaml:"mainparams"`
}

Options are the per-task options

type Require

type Require struct {
	Exists      []string          `yaml:"exists"`
	NotExists   []string          `yaml:"notExists"`
	Environment map[string]string `yaml:"environment,omitempty"`
	Variables   map[string]string `yaml:"variables,omitempty"`
}

Require defines what is required to execute the task

type RequireCheck

type RequireCheck struct {
	FileExists    []string
	FileNotExists []string
}

RequireCheck defines some variables they have to be valid before script runs

type RunConfig

type RunConfig struct {
	Config Config `yaml:"config"`
	Task   []Task `yaml:"task"`
}

RunConfig defines the structure of the local stored execution files

type StopReasons

type StopReasons struct {
	Onerror        bool
	OnoutcountLess int
	OnoutcountMore int
	OnoutContains  []string
}

StopReasons mapping for RunConfig.Task[].Stopreasons

type Stopreasons

type Stopreasons struct {
	Onerror        bool     `yaml:"onerror"`
	OnoutcountLess int      `yaml:"onoutcountLess"`
	OnoutcountMore int      `yaml:"onoutcountMore"`
	OnoutContains  []string `yaml:"onoutContains"`
}

Stopreasons defines reasons to stop execution of the script all of them depends currently on parsing the output or just if a error happens by trying to execute a script-line

type Task

type Task struct {
	ID          string            `yaml:"id"`
	Variables   map[string]string `yaml:"variables,omitempty"`
	Requires    Require           `yaml:"require"`
	Stopreasons Stopreasons       `yaml:"stopreasons"`
	Options     Options           `yaml:"options"`
	Script      []string          `yaml:"script"`
	Listener    []Listener        `yaml:"listener"`
	Next        []string          `yaml:"next"`
}

Task is the main Script

type Trigger

type Trigger struct {
	Onerror        bool     `yaml:"onerror"`
	OnoutcountLess int      `yaml:"onoutcountLess"`
	OnoutcountMore int      `yaml:"onoutcountMore"`
	OnoutContains  []string `yaml:"onoutContains"`
}

Trigger are part of listener. The defines some events they are triggered by executing scripts most of them watching the output

Jump to

Keyboard shortcuts

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