1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/cnbutils/order.go
Pavel Busko 372cef04b4
feat(cnbBuild): added support for project.toml (#3163)
Co-authored-by: Sumit Kulhadia <sumit.kulhadia@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2021-10-11 11:10:21 +02:00

33 lines
485 B
Go

package cnbutils
import (
"bytes"
toml "github.com/pelletier/go-toml"
)
type Order struct {
Order []OrderEntry `toml:"order"`
Utils BuildUtils `toml:"-"`
}
type OrderEntry struct {
Group []BuildPackMetadata `toml:"group" json:"group"`
}
func (o Order) Save(path string) error {
var buf bytes.Buffer
err := toml.NewEncoder(&buf).Encode(o)
if err != nil {
return err
}
err = o.Utils.FileWrite(path, buf.Bytes(), 0644)
if err != nil {
return err
}
return nil
}