mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
79f7ccd0f5
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com> Co-authored-by: Benjamin Haegenlaeuer <benjamin.haegenlaeuer@sap.com>
33 lines
480 B
Go
33 lines
480 B
Go
package cnbutils
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"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
|
|
}
|