manager

package
v0.0.0-...-a80f706 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ORIGINAL_TASK = "ORIGINAL_TASK"
	CURRENT_TASK  = "CURRENT_TASK"
	CURRENT_PKG   = "CURRENT_PKG"
	SUDO          = "SUDO"
	CONFIG_PATH   = "CONFIG_PATH"
	TARGET_PATH   = "TARGET_PATH"
	SOURCE_PATH   = "SOURCE_PATH"
)

Variables

This section is empty.

Functions

func New

func New(fs io.Filesystem, shell io.Shell) manager

func NewDecider

func NewDecider(r io.Shell) *decider

Types

type Decider

type Decider interface {
	ShouldRun(ctx context.Context, skipIf []string, runIf []string) bool
}

type Downloads

type Downloads []string

type General

type General struct {
	InstallerPreferences []string `toml:"installer_preferences"`
	ConfigDir            string   `toml:"config_dir"`
	HomeDir              string   `toml:"home_dir"`
}

The General section of a TOML config

type Installer

type Installer struct {
	Name    string
	RunIf   []string `toml:"run_if"`
	Sudo    bool
	Cmd     string
	Update  string
	Updated bool
}

An installer definition from a TOML config

type Manager

type Manager interface {
	Start(ctx context.Context, config Recipe, operation Operation, name string) error
}

type Operation

type Operation string
const (
	SYNC    Operation = "sync"
	INSTALL Operation = "install"
	TASK    Operation = "task"
)

type Package

type Package map[string]string

A package alias as defined in a TOML config It translates a common name like "vim" to the package name for the specific installer.

type Recipe

type Recipe struct {
	General       General              `toml:"general"`
	Packages      map[string]Package   `toml:"pkg"`
	Shells        map[string]Shell     `toml:"shell"`
	InstallerDefs map[string]Installer `toml:"installer"`
	Tasks         map[string]Task      `toml:"task"`
}

func ResolveRecipe

func ResolveRecipe(fs io.Filesystem, configLocation string) (*Recipe, error)

type RunConfig

type RunConfig struct {
	RecipeLocation string
	Operation      Operation
	Recipe         Recipe
	ForceInstaller string // ForceInstaller will try to force the specified installer
	Sudo           string // Sudo will force using sudo when performing commands
	Verbose        bool   // Talk more
	DryRun         bool   // Don't actually run installation/copy/symlink commands
	TargetDir      string // TargetDir is the base directory for symlinks, defaults to ${HOME}
	SourceDir      string // SourceDir is the base directory to search for source files to symlink against, defaults to dir(RecipeLocation)
	// contains filtered or unexported fields
}

type Shell

type Shell struct {
	Download []Downloads `toml:"download"`
	Cmds     []string    `toml:"cmds"`
}

type Task

type Task struct {
	Installers []string
	RunIf      []string
	SkipIf     []string
	Download   []Downloads
	Deps       []string
	PreCmds    []string `toml:"pre_cmd"`
	Install    []string
	PostCmds   []string `toml:"post_cmd"`
}

A task as define in a TOML config

Jump to

Keyboard shortcuts

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