package Package
|
|
|
|
import (
|
|
yaml "gopkg.in/yaml.v2"
|
|
)
|
|
|
|
type Manifest struct {
|
|
Name string `yaml:"name"`
|
|
Version string `yaml:"version"`
|
|
Dependancies map[string]string `yaml:"dependancies,flow"`
|
|
}
|
|
|
|
func ParseManifestFile(manifest string) (Manifest, error) {
|
|
var (
|
|
m Manifest = Manifest{}
|
|
e error
|
|
)
|
|
|
|
e = yaml.Unmarshal([]byte(manifest), &m)
|
|
return m, e
|
|
}
|
|
|
|
func (m Manifest) CreateManifestString() (string, error) {
|
|
var (
|
|
mByte []byte
|
|
e error
|
|
)
|
|
mByte, e = yaml.Marshal(&m)
|
|
if e != nil {
|
|
return "", e
|
|
}
|
|
return string(mByte), e
|
|
}
|