Documentation
¶
Index ¶
- Constants
- Variables
- func LoadConfigFileFromPath[T any](path string) (*T, error)
- type ConfigMap
- type ConfirmStep
- type CopyFileStep
- type CreateDirIfNotExistsStep
- type CreateDirStep
- type CreateFileStep
- type CreateSymlinkStep
- type Dependency
- type DothFile
- type ExecuteShellCommandStep
- type FileStrategy
- type LogStep
- type Module
- type ModuleFile
- type PackageConfig
- type PackageSource
- type Pipeline
- func (p *Pipeline) AddModule(module PipelineModule) *Pipeline
- func (p *Pipeline) Apply(input PipelineConfig) error
- func (p *Pipeline) ApplyDry(input PipelineConfig) error
- func (p *Pipeline) ApplyVerbose(input PipelineConfig) error
- func (p *Pipeline) Run(dry bool, verbose bool, config PipelineConfig) error
- type PipelineConfig
- type PipelineModule
- func NewConfirmStep(message string) PipelineModule
- func NewCopyFileStep(src string, dst string) PipelineModule
- func NewCreateDirIfNotExistsStep(path string, role string) PipelineModule
- func NewCreateDirStep(path string, role string) PipelineModule
- func NewCreateFileStep(path string, content []byte, role string) PipelineModule
- func NewCreateFileStepWithPermissions(path string, content []byte, role string, permissions os.FileMode) PipelineModule
- func NewCreateSymlinkStep(src string, dst string) PipelineModule
- func NewExecuteShellCommandStep(command string, silent bool) PipelineModule
- func NewLogStep(message string, dryOnly bool) PipelineModule
- func NewRenderFileStep(templatePath string, configMap ConfigMap, dst string) PipelineModule
- type RenderFileStep
Constants ¶
View Source
const DothFileLocation = "./doth.yaml"
View Source
const DothFileLocationAlt = "./doth.yml"
View Source
const DothLockFileLocation = "./doth.lock"
View Source
const DothShWrapperLocation = "./doth.sh"
View Source
const GitignoreFileLocation = "./.gitignore"
View Source
const LocalStateDir = "./.doth"
View Source
const ModuleFileName = "module.yaml"
View Source
const ModuleFileNameAlt = "module.yml"
Variables ¶
View Source
var DothFileTemplate string
View Source
var DothShWrapper string
View Source
var GitignoreFileTemplate string
View Source
var Version string
Functions ¶
func LoadConfigFileFromPath ¶
Types ¶
type ConfigMap ¶
func LoadConfigFiles ¶
func (ConfigMap) GetPackageConfig ¶
func (configMap ConfigMap) GetPackageConfig() (*PackageConfig, error)
type ConfirmStep ¶
type ConfirmStep struct {
// contains filtered or unexported fields
}
func (*ConfirmStep) Apply ¶
func (s *ConfirmStep) Apply(config PipelineConfig) error
func (*ConfirmStep) ApplyDry ¶
func (s *ConfirmStep) ApplyDry(config PipelineConfig) (string, error)
type CopyFileStep ¶
type CopyFileStep struct {
// contains filtered or unexported fields
}
func (*CopyFileStep) Apply ¶
func (s *CopyFileStep) Apply(config PipelineConfig) error
func (*CopyFileStep) ApplyDry ¶
func (s *CopyFileStep) ApplyDry(config PipelineConfig) (string, error)
type CreateDirIfNotExistsStep ¶
type CreateDirIfNotExistsStep struct {
// contains filtered or unexported fields
}
func (*CreateDirIfNotExistsStep) Apply ¶
func (s *CreateDirIfNotExistsStep) Apply(config PipelineConfig) error
func (*CreateDirIfNotExistsStep) ApplyDry ¶
func (s *CreateDirIfNotExistsStep) ApplyDry(config PipelineConfig) (string, error)
type CreateDirStep ¶
type CreateDirStep struct {
// contains filtered or unexported fields
}
func (*CreateDirStep) Apply ¶
func (s *CreateDirStep) Apply(config PipelineConfig) error
func (*CreateDirStep) ApplyDry ¶
func (s *CreateDirStep) ApplyDry(config PipelineConfig) (string, error)
type CreateFileStep ¶
type CreateFileStep struct {
// contains filtered or unexported fields
}
func (*CreateFileStep) Apply ¶
func (s *CreateFileStep) Apply(config PipelineConfig) error
func (*CreateFileStep) ApplyDry ¶
func (s *CreateFileStep) ApplyDry(config PipelineConfig) (string, error)
type CreateSymlinkStep ¶
type CreateSymlinkStep struct {
// contains filtered or unexported fields
}
func (*CreateSymlinkStep) Apply ¶
func (s *CreateSymlinkStep) Apply(config PipelineConfig) error
func (*CreateSymlinkStep) ApplyDry ¶
func (s *CreateSymlinkStep) ApplyDry(config PipelineConfig) (string, error)
type Dependency ¶
type DothFile ¶
type DothFile struct {
// Relative path to the module directory, e.g. "./modules" or "."
ModulePath string `yaml:"modulePath"`
Deps []Dependency `yaml:"deps"`
RequireConfig bool `yaml:"requireConfig"`
// Version of doth used. Incompable versions will cause an error on load.
// There are automatic migrations from older->newer, but not the other way around.
DothFormatVersion uint32 `yaml:"dothVersionDoNotEditManually"`
}
func LoadDothFileFromCwd ¶
type ExecuteShellCommandStep ¶
type ExecuteShellCommandStep struct {
// contains filtered or unexported fields
}
func (*ExecuteShellCommandStep) Apply ¶
func (s *ExecuteShellCommandStep) Apply(config PipelineConfig) error
func (*ExecuteShellCommandStep) ApplyDry ¶
func (s *ExecuteShellCommandStep) ApplyDry(config PipelineConfig) (string, error)
type FileStrategy ¶
type FileStrategy string
const ( StrategyCopy FileStrategy = "copy" StrategyLink FileStrategy = "link" StrategyRender FileStrategy = "render" )
type LogStep ¶
type LogStep struct {
// contains filtered or unexported fields
}
func (*LogStep) Apply ¶
func (s *LogStep) Apply(config PipelineConfig) error
type Module ¶
type Module struct {
Target string `yaml:"target"`
Skip bool `yaml:"skip"` // if true, the module will be fully ignored when deploying
Files []ModuleFile `yaml:"files"`
Deps []Dependency `yaml:"deps"`
BasePath string `yaml:"-"` // module path on disk, dynamically set when loading
}
type ModuleFile ¶
type ModuleFile struct {
// Name is the filename or relative path to the file within the module folder - may use glob patterns
Name string `yaml:"name"`
// Strategy is the strategy to use when deploying the file to it's target location. Defaults to "copy".
Strategy FileStrategy `yaml:"strategy"`
TargetOverride string `yaml:"target"` // if set, this path will be used instead of the default target path (module target + file name)
}
type PackageConfig ¶
type PackageConfig struct {
/**
PackageSources is a list of package managers available on the target system.
Use {package} as a placeholder for the package name (and version if needed) in the command.
If multiple sources are valid for a package, the first one found will be used.
Example configuration:
packageSources:
- name: "pacman"
command: "sudo pacman -S {package}"
- name: "paru"
command: "paru -S {package}"
- name: "go"
command: "go install {package}"
- name: "npm"
command: "npm install -g {package}"
*/
PackageSources []PackageSource `yaml:"packageSources"`
}
type PackageSource ¶
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline represents a planned sequence of small operations. It can apply them, or print out what it would do (dry run), or print out what it is doing as it does it (verbose).
func NewPipeline ¶
func NewPipeline() *Pipeline
func (*Pipeline) AddModule ¶
func (p *Pipeline) AddModule(module PipelineModule) *Pipeline
func (*Pipeline) Apply ¶
func (p *Pipeline) Apply(input PipelineConfig) error
func (*Pipeline) ApplyDry ¶
func (p *Pipeline) ApplyDry(input PipelineConfig) error
func (*Pipeline) ApplyVerbose ¶
func (p *Pipeline) ApplyVerbose(input PipelineConfig) error
type PipelineConfig ¶
func CreatePipelineConfig ¶
func CreatePipelineConfig(force bool, autoconfirm bool) PipelineConfig
type PipelineModule ¶
type PipelineModule interface {
Apply(input PipelineConfig) error
ApplyDry(input PipelineConfig) (string, error)
}
PipelineModule represents a single operation that can be applied, or printed out in a dry run.
func NewConfirmStep ¶
func NewConfirmStep(message string) PipelineModule
func NewCopyFileStep ¶
func NewCopyFileStep(src string, dst string) PipelineModule
func NewCreateDirIfNotExistsStep ¶
func NewCreateDirIfNotExistsStep(path string, role string) PipelineModule
func NewCreateDirStep ¶
func NewCreateDirStep(path string, role string) PipelineModule
func NewCreateFileStep ¶
func NewCreateFileStep(path string, content []byte, role string) PipelineModule
func NewCreateSymlinkStep ¶
func NewCreateSymlinkStep(src string, dst string) PipelineModule
func NewExecuteShellCommandStep ¶
func NewExecuteShellCommandStep(command string, silent bool) PipelineModule
func NewLogStep ¶
func NewLogStep(message string, dryOnly bool) PipelineModule
func NewRenderFileStep ¶
func NewRenderFileStep(templatePath string, configMap ConfigMap, dst string) PipelineModule
type RenderFileStep ¶
type RenderFileStep struct {
// contains filtered or unexported fields
}
func (*RenderFileStep) Apply ¶
func (s *RenderFileStep) Apply(config PipelineConfig) error
func (*RenderFileStep) ApplyDry ¶
func (s *RenderFileStep) ApplyDry(config PipelineConfig) (string, error)
Click to show internal directories.
Click to hide internal directories.