PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
776 B

  1. package Package
  2. import (
  3. yaml "gopkg.in/yaml.v2"
  4. )
  5. type Manifest struct {
  6. Name string `yaml:"name"`
  7. Version string `yaml:"version"`
  8. Symlinks map[string]string `yaml:"symlinks,flow"`
  9. Dependancies map[string]string `yaml:"dependancies,flow"`
  10. PreInstallCmds string `yaml:"pre_install_cmds"`
  11. PostInstallCmds string `yaml:"post_install_cmds"`
  12. }
  13. func ParseManifestFile(manifest string) (Manifest, error) {
  14. var (
  15. m Manifest = Manifest{}
  16. e error
  17. )
  18. e = yaml.Unmarshal([]byte(manifest), &m)
  19. return m, e
  20. }
  21. func (m Manifest) CreateManifestString() (string, error) {
  22. var (
  23. mByte []byte
  24. e error
  25. )
  26. mByte, e = yaml.Marshal(&m)
  27. if e != nil {
  28. return "", e
  29. }
  30. return string(mByte), e
  31. }