installer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: MIT Imports: 16 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)>

Index

Constants

This section is empty.

Variables

View Source
var DoTags, SkipTags []string
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
}

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) 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 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) 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 {
	Status  bool
	Remove  bool
	Install bool
	Verbose bool
	Facts   genesis.Facts
	Dir     string
	Store   *store.Store
	Tasks   []genesis.Doer
}

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

func New

func New() *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) 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) GatherFacts

func (inst *Installer) GatherFacts()

GatherFacts learns stuff about the target system.

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) 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 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) 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