config

package
v0.0.55-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checksum added in v0.0.50

type Checksum map[string][]string

Checksum type for all checksum uses (env, command.env, command,checksum).

func (*Checksum) UnmarshalYAML added in v0.0.50

func (c *Checksum) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Cmd added in v0.0.50

type Cmd struct {
	Name   string
	Script string // list will be joined
}

type Cmds added in v0.0.50

type Cmds struct {
	Commands []*Cmd
	Append   bool
	Parallel bool
}

func (Cmds) AppendArgs added in v0.0.50

func (c Cmds) AppendArgs(args []string)

AppendArgs appends arguments to cmd script.

func (Cmds) Clone added in v0.0.50

func (c Cmds) Clone() Cmds

func (*Cmds) UnmarshalYAML added in v0.0.50

func (c *Cmds) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Command

type Command struct {
	Name string
	// Represents a list of commands (scripts)
	Cmds Cmds
	// script to run after cmd finished (cleanup, etc)
	After string
	// overrides global shell for this particular command
	Shell string
	// overrides global workdir (where lets.yaml is located) for this particular command
	WorkDir     string
	Description string
	// env from command
	Env *Envs
	// store docopts from options directive
	Docopts         string
	SkipDocopts     bool // default false
	Options         map[string]string
	CliOptions      map[string]string
	Depends         *Deps
	ChecksumMap     map[string]string
	PersistChecksum bool
	// args from 'lets run --debug' will become [--debug]
	Args []string

	ChecksumSources map[string][]string
	// contains filtered or unexported fields
}

func (*Command) ChecksumCalculator

func (c *Command) ChecksumCalculator(workDir string) error

func (*Command) Clone added in v0.0.50

func (c *Command) Clone() *Command

func (*Command) Dump added in v0.0.50

func (c *Command) Dump() string

func (*Command) GetEnv added in v0.0.50

func (c *Command) GetEnv(cfg Config) (map[string]string, error)

func (*Command) GetPersistedChecksums

func (c *Command) GetPersistedChecksums() map[string]string

func (*Command) Help

func (c *Command) Help() string

func (*Command) ReadChecksumsFromDisk

func (c *Command) ReadChecksumsFromDisk(checksumsDir string, cmdName string, checksumMap map[string]string) error

ReadChecksumsFromDisk reads all checksums for cmd into map.

func (*Command) UnmarshalYAML added in v0.0.50

func (c *Command) UnmarshalYAML(unmarshal func(interface{}) error) error

type Commands added in v0.0.50

type Commands map[string]*Command

type Config

type Config struct {
	// absolute path to work dir - where config is placed
	WorkDir string
	// absolute path for lets config file
	FilePath string
	Commands Commands
	Shell    string
	// before is a script which will be included before every cmd
	Before string
	// init is a script which will be called exactly once before any command calls
	Init    string
	Env     *Envs
	Version string

	// absolute path to .lets
	DotLetsDir string
	// absolute path to .lets/checksums
	ChecksumsDir string
	// absolute path to .lets/mixins
	MixinsDir string
	// contains filtered or unexported fields
}

Config is a struct for loaded config file.

func NewConfig

func NewConfig(workDir string, configAbsPath string, dotLetsDir string) *Config

func NewMixinConfig

func NewMixinConfig(cfg *Config, configAbsPath string) *Config

func (*Config) CreateChecksumsDir added in v0.0.49

func (c *Config) CreateChecksumsDir() error

func (*Config) GetEnv added in v0.0.50

func (c *Config) GetEnv() map[string]string

func (*Config) SetupEnv added in v0.0.50

func (c *Config) SetupEnv() error

SetupEnv must be called once. It is not intended to be called multiple times hence does not have mutex.

func (*Config) UnmarshalYAML added in v0.0.50

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

type Dep

type Dep struct {
	Name string
	Args []string
	Env  *Envs
}

func (Dep) Clone added in v0.0.50

func (d Dep) Clone() Dep

func (Dep) HasArgs added in v0.0.50

func (d Dep) HasArgs() bool

func (*Dep) UnmarshalYAML added in v0.0.50

func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Deps added in v0.0.50

type Deps struct {
	Keys    []string
	Mapping map[string]Dep
}

func (*Deps) Clone added in v0.0.50

func (d *Deps) Clone() *Deps

func (*Deps) Get added in v0.0.50

func (d *Deps) Get(key string) *Dep

Get get a value by a given key.

func (*Deps) Has added in v0.0.50

func (d *Deps) Has(key string) bool

Has checks if a value exists by a given key.

func (*Deps) Range added in v0.0.50

func (d *Deps) Range(yield func(key string, value Dep) error) error

Range allows you to loop into the Deps in its right order.

func (*Deps) Set added in v0.0.50

func (d *Deps) Set(key string, value Dep)

Set sets a value to a given key.

func (*Deps) UnmarshalYAML added in v0.0.50

func (d *Deps) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Env added in v0.0.50

type Env struct {
	Name     string
	Value    string
	Sh       string
	Checksum Checksum
}

func (*Env) UnmarshalYAML added in v0.0.50

func (e *Env) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Envs added in v0.0.50

type Envs struct {
	Keys    []string
	Mapping map[string]Env
	// contains filtered or unexported fields
}

func (*Envs) Clone added in v0.0.50

func (e *Envs) Clone() *Envs

func (*Envs) Dump added in v0.0.50

func (e *Envs) Dump() map[string]string

func (*Envs) Empty added in v0.0.50

func (e *Envs) Empty() bool

func (*Envs) Execute added in v0.0.50

func (e *Envs) Execute(cfg Config) error

Execute executes env entries for sh scrips and calculate checksums It is lazy and caches data on first call.

func (*Envs) Has added in v0.0.50

func (e *Envs) Has(key string) bool

Has checks if a value exists by a given key.

func (*Envs) Merge added in v0.0.50

func (e *Envs) Merge(other *Envs)

Merge merges the given Envs into the existing Envs. If current env not exists bu other exists we just init current env with other env.

func (*Envs) MergeMap added in v0.0.50

func (e *Envs) MergeMap(other map[string]string)

MergeMap merges the given map into the existing Envs.

func (*Envs) Range added in v0.0.50

func (e *Envs) Range(yield func(key string, value Env) error) error

Range allows you to loop into the envs in its right order.

func (*Envs) Set added in v0.0.50

func (e *Envs) Set(key string, value Env)

Set sets a value to a given key.

func (*Envs) UnmarshalYAML added in v0.0.50

func (e *Envs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Mixin added in v0.0.50

type Mixin struct {
	FileName string
	// e.g. .gitignored
	Ignored bool
	Remote  *RemoteMixin
}

func (*Mixin) IsRemote added in v0.0.50

func (m *Mixin) IsRemote() bool

func (*Mixin) UnmarshalYAML added in v0.0.50

func (m *Mixin) UnmarshalYAML(unmarshal func(interface{}) error) error

type Mixins added in v0.0.50

type Mixins []*Mixin

type RemoteMixin added in v0.0.50

type RemoteMixin struct {
	URL     string
	Version string
	// contains filtered or unexported fields
}

func (*RemoteMixin) Filename added in v0.0.50

func (rm *RemoteMixin) Filename() string

Filename is name of mixin file (hash from url).

func (*RemoteMixin) Path added in v0.0.50

func (rm *RemoteMixin) Path() string

Path is abs path to mixin file (.lets/mixins/<filename>).

type Version added in v0.0.50

type Version string

func (*Version) UnmarshalYAML added in v0.0.50

func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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