You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
739 B
Go
37 lines
739 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type Pipeline struct {
|
|
// Pipeline is a list of operations, each one should have at least one key in "source", "use", "target". The remaining keys are options for that operation
|
|
Pipeline []map[string]any `yaml:"pipeline"`
|
|
}
|
|
|
|
type BuildOptions struct {
|
|
// Excludes lists files and folders to globally exclude from compilation
|
|
Excludes []string `yaml:",omitempty"`
|
|
}
|
|
|
|
type Cabretfile struct {
|
|
Options BuildOptions
|
|
Build []Pipeline
|
|
}
|
|
|
|
func ReadCabretfile(file string) (*Cabretfile, error) {
|
|
f, err := os.Open(file)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
site := new(Cabretfile)
|
|
if err := yaml.NewDecoder(f).Decode(site); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return site, nil
|
|
}
|