usecase

package
v0.0.0-...-03481f5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCommandEnvsToTask

func AppendCommandEnvsToTask(cmd *entity.Command, task *entity.Task)

func CheckInitialArgs

func CheckInitialArgs(network *entity.Network, initialArgs *entity.InitialArgs)

func CreateTasks

func CreateTasks(cmd *entity.Command, clients []entity.ClientFacade, env entity.EnvList, args *entity.InitialArgs) ([]*entity.Task, error)

func EnsureLocalhost

func EnsureLocalhost(supFile *entity.Supfile)

func GenerateSUPENVFrom

func GenerateSUPENVFrom(vars *entity.EnvList)

GenerateSUPENVFrom generates the SUP_ENV environment variable from the environment variables in the vars list

func LocalTarCmdArgs

func LocalTarCmdArgs(path, exclude string) []string

func MergeVars

func MergeVars(conf *entity.Supfile, network *entity.Network) entity.EnvList

MergeVars merges two entity.EnvList lists, one from supfile and one from network, resolves the values of the environment variables with shell substitution, and returns the merged list of environment variables

func NewSupfile

func NewSupfile(data []byte) (*entity.Supfile, error)

NewSupfile parses configuration file and returns Supfile or error.

func NewTarStreamReader

func NewTarStreamReader(cwd, path, exclude string) (io.Reader, error)

NewTarStreamReader creates a tar stream reader from a local path. TODO: Refactor. Use "archive/tar" instead.

func ParseInitialArgs

func ParseInitialArgs(initData entity.InitState) (*entity.PlayBook, error)

ParseInitialArgs parses args and returns network and commands to be run. On error, it prints usage and exits.

func ReadSupfile

func ReadSupfile(initialArgs *entity.InitialArgs) *entity.Supfile

ReadSupfile looks for Supfile or Supfiley.yml in the current working directory, cd's to Supfile dir, reads it and calls NewSupfile, after all returns the parsed Supfile.

func RemoteTarCommand

func RemoteTarCommand(dir string) string

RemoteTarCommand returns command to be run on remote SSH host to properly receive the created TAR stream. TODO: Check for relative directory.

func ResolveLocalPath

func ResolveLocalPath(cwd, path, env string) (string, error)

ResolveLocalPath - Use bash to resolve $ENV_VARs. like: `~/dir` or `$HOME/dir`

func ResolvePath

func ResolvePath(path string) string

ResolvePath resolves a path relative to the current working directory

func ResolveValues

func ResolveValues(e *entity.EnvList) error

func RunShellcheck

func RunShellcheck(supFile *entity.Supfile) error

func SetEnvValues

func SetEnvValues(vars *entity.EnvList, initialArgs *entity.InitialArgs)

SetEnvValues sets vars from env pairs inside the initialArgs.EnvVars, values there will be given as 'key=value'

func TargetsHaveAffixes

func TargetsHaveAffixes(conf *entity.Supfile) bool

Types

type ShellCheck

type ShellCheck struct{}

func New

func New() *ShellCheck

func (*ShellCheck) Check

func (s *ShellCheck) Check(task *entity.Task) error

type Stackup

type Stackup struct {
	Args *entity.InitialArgs
	// contains filtered or unexported fields
}

func NewStackup

func NewStackup(conf *entity.Supfile) (*Stackup, error)

NewStackup creates a new Stackup instance.

func (*Stackup) Debug

func (sup *Stackup) Debug(value bool)

Debug sets whether or not to print debug messages

func (*Stackup) Prefix

func (sup *Stackup) Prefix(value bool)

Prefix sets the host prefix for printing output from it

func (*Stackup) Run

func (sup *Stackup) Run(network *entity.Network, envVars entity.EnvList, commands ...*entity.Command) error

Run runs set of commands on multiple hosts defined by network sequentially.

TODO: This megamoth method needs a big refactor and should be split
to multiple smaller methods.

Jump to

Keyboard shortcuts

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