installer

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package installer is the installer for the genesis package. It handles file backup, manages history, reports on progress, and invents higher-order tasks (such as if-then tasks)>

Package installer is the installer for the genesis package. It handles file backup, manages history, reports on progress, and invents higher-order tasks (such as if-then tasks)>

Index

Constants

This section is empty.

Variables

View Source
var DoTags, SkipTags []string

DoTags and SkipTags are global variables, because we need to modify them as we descend into sections and unmodify them on the way back up.

View Source
var StatusCount struct {
	Pass, Fail, Unknown, Done int
}

Functions

func EmptyDoTags

func EmptyDoTags() []string

func GetHistory added in v0.2.0

func GetHistory(dir string) []string

func PrintHeader

func PrintHeader(tag, desc string)

func PrintSectionFooter

func PrintSectionFooter(name string)

func PrintSectionHeader

func PrintSectionHeader(name string)

func ReportDone added in v0.1.1

func ReportDone(msg string, err error)

func ReportFail

func ReportFail(msg string, err error)

func ReportPass

func ReportPass(msg string, err error)

func ReportSummary added in v0.1.1

func ReportSummary()

func ReportUnknown

func ReportUnknown(msg string, err error)

func Rerun added in v0.2.0

func Rerun(dir string) (string, error)

func RestoreDoTags

func RestoreDoTags(doTags []string)

func SaveHistory added in v0.2.0

func SaveHistory(dir string, cmd []string) error

func SkipID

func SkipID(id string) string

Types

type Custom

type Custom struct {
	Task genesis.Doer
	S    func() (genesis.Status, error)
	D    func() (bool, error)
	U    func() (bool, error)
	I    func() string
	F    func() []string
}

Custom is a type of genesis.Doer. It is a wrapper around another Doer which allows for custom Status/Do/Undo functions.

func NewCustom

func NewCustom(task genesis.Doer) *Custom

func (Custom) Do

func (custom Custom) Do() (bool, error)

func (Custom) Files added in v0.3.1

func (custom Custom) Files() []string

func (Custom) ID

func (custom Custom) ID() string

func (Custom) Status

func (custom Custom) Status() (genesis.Status, error)

func (Custom) Undo

func (custom Custom) Undo() (bool, error)

type FlagMerger added in v0.3.1

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

func NewFlagMerger added in v0.3.1

func NewFlagMerger() *FlagMerger

func (*FlagMerger) IsDefined added in v0.3.1

func (fm *FlagMerger) IsDefined(name string) bool

type IfThen

type IfThen struct {
	If   genesis.Doer
	Then genesis.Doer
}

IfThen is a type of genesis.Doer. It runs doer B if and only if doer A runs.

func (IfThen) Do

func (ifthen IfThen) Do() (bool, error)

func (IfThen) Files added in v0.3.1

func (ifthen IfThen) Files() []string

func (IfThen) ID

func (ifthen IfThen) ID() string

ID for IfThen is just the combination of the two Doer IDs.

func (IfThen) Status

func (ifthen IfThen) Status() (genesis.Status, error)

func (IfThen) Undo

func (ifthen IfThen) Undo() (bool, error)

type Installer

type Installer struct {
	Cmd       string
	Verbose   bool
	Facts     genesis.Facts
	Tasks     []genesis.Doer
	Dir       string
	Gendir    string
	DoTags    string
	SkipTags  string
	UserFlags []*flag.FlagSet
	ExecName  string
	BuildDirs []string
}

Installer is a wrapper around modules to provide a nice interface for building an installer.

func New

func New(userFlags ...*flag.FlagSet) *Installer

New creates a new installer object.

func (*Installer) Add

func (inst *Installer) Add(task genesis.Doer)

func (*Installer) AddTask

func (inst *Installer) AddTask(module genesis.Module)

func (*Installer) Build added in v0.3.1

func (inst *Installer) Build()

func (*Installer) CleanUp

func (inst *Installer) CleanUp()

CleanUp removes the temporary directory.

func (*Installer) Done

func (inst *Installer) Done()

Done finishes up the installer process.

func (*Installer) Files added in v0.3.1

func (inst *Installer) Files() []string

func (*Installer) Init added in v0.3.1

func (inst *Installer) Init() *Installer

func (*Installer) ParseFlags added in v0.3.1

func (inst *Installer) ParseFlags()

ParseFlags does all the flag parsing for the installer.

type Section

type Section struct {
	Tasks []genesis.Doer
	Name  string
}

Section is a type of genesis.Doer. It groups Doers together with a label. It is useful for two reasons: 1) it allows for pretty labels in the output, and 2) it can group tasks together into a Doer that can be used as part of other Doers.

func NewGroup

func NewGroup() *Section

func NewSection

func NewSection(name string) *Section

func (*Section) Add

func (section *Section) Add(doer genesis.Doer)

func (*Section) AddTask

func (section *Section) AddTask(module genesis.Module)

func (Section) Do

func (section Section) Do() (bool, error)

func (Section) Files added in v0.3.1

func (section Section) Files() []string

func (Section) ID

func (section Section) ID() string

func (Section) Status

func (section Section) Status() (genesis.Status, error)

func (Section) Undo

func (section Section) Undo() (bool, error)

type Switch added in v0.3.1

type Switch struct {
	Dos   []genesis.Doer
	Donts []genesis.Doer
	Name  string
}

Switch runs a Doer depending on a value.

func NewSwitch added in v0.3.1

func NewSwitch(name string) *Switch

func (*Switch) Case added in v0.3.1

func (sw *Switch) Case(condition bool, doer genesis.Doer)

func (Switch) Do added in v0.3.1

func (sw Switch) Do() (bool, error)

func (*Switch) Else added in v0.3.1

func (sw *Switch) Else(doer genesis.Doer)

Else -- if all existing tasks are false, then this is true. If any existing task is true, this is false.

func (Switch) Files added in v0.3.1

func (sw Switch) Files() []string

func (Switch) ID added in v0.3.1

func (sw Switch) ID() string

func (Switch) Status added in v0.3.1

func (sw Switch) Status() (genesis.Status, error)

func (Switch) Undo added in v0.3.1

func (sw Switch) Undo() (bool, error)

type Task

type Task struct {
	genesis.Module
}

Task is the most fundamental Doer. It consists of just a single module. All other Doers contain tasks at their deepest levels (i.e. only a Task can contain a module directly.

func (Task) Do

func (task Task) Do() (bool, error)

func (Task) Files added in v0.3.1

func (task Task) Files() []string

func (Task) Status

func (task Task) Status() (genesis.Status, error)

func (Task) Undo

func (task Task) Undo() (bool, error)

Jump to

Keyboard shortcuts

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