manifest

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package manifest handles loading and writing of the C3PM manifest file (usually c3pm.yml). It also stores the various types supported by the manifest, as well as utility functions to use them.

Index

Constants

View Source
const (
	// Executable is the Type of a project yielding a binary executable.
	Executable = Type("executable")
	// Library is the Type of a project yielding a package to be included by others.
	Library = Type("library")
)
View Source
const (
	// C3PMVersion1 is the most recent manifest version.
	C3PMVersion1 = C3PMVersion(1)
)

Variables

View Source
var ErrParseC3PMVersion = errors.New("Could not parse C3PM version")

ErrParseC3PMVersion is returned when not able to parse the C3PM version to use.

View Source
var ErrParseDependencies = errors.New("Could not parse dependencies")

ErrParseDependencies is returned when an error occured while reading dependencies.

Functions

This section is empty.

Types

type AdapterConfig added in v0.1.0

type AdapterConfig struct {
	Name    string  `yaml:"name"`
	Version Version `yaml:"version,omitempty"`
}

type BuildConfig added in v0.1.0

type BuildConfig struct {
	Adapter *AdapterConfig `yaml:"adapter,omitempty"`
	Config  interface{}    `yaml:"config,omitempty"`
}

type C3PMVersion added in v0.1.0

type C3PMVersion uint32

C3PMVersion holds the version of the c3pm manifest to use.

func C3PMVersionFromString added in v0.1.0

func C3PMVersionFromString(version string) (C3PMVersion, error)

C3PMVersionFromString returns the C3PMVersion corresponding to a given string.

func (C3PMVersion) MarshalYAML added in v0.1.0

func (v C3PMVersion) MarshalYAML() (interface{}, error)

MarshalYAML is used to write the version as YAML.

func (C3PMVersion) String added in v0.1.0

func (v C3PMVersion) String() string

String is used to return the stringified representation of the version.

func (*C3PMVersion) UnmarshalYAML added in v0.1.0

func (v *C3PMVersion) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is used to read the version from the manifest YAML file.

type CustomCMake added in v0.1.0

type CustomCMake struct {
	Path      string            `yaml:"path"`
	Variables map[string]string `yaml:"variables"`
	Targets   []string          `yaml:"targets"`
}

CustomCMake is used in cases where a project needs a complex custom CMake system.

type Dependencies

type Dependencies map[string]string

Dependencies holds the list of the dependencies of a project.

func DependenciesFromMap

func DependenciesFromMap(dependencies map[string]string) (Dependencies, error)

TODO: Unused

func (Dependencies) Append added in v0.3.0

func (d Dependencies) Append(d2 Dependencies) Dependencies

func (Dependencies) MarshalYAML

func (d Dependencies) MarshalYAML() (interface{}, error)

MarshalYAML is used to write dependencies as YAML.

func (Dependencies) String added in v0.2.0

func (d Dependencies) String() string

type Manifest

type Manifest struct {
	C3PMVersion      C3PMVersion    `yaml:"c3pm_version"`
	Type             Type           `yaml:"type"`
	Name             string         `yaml:"name"`
	Description      string         `yaml:"description"`
	Version          Version        `yaml:"version"`
	Publish          *PublishConfig `yaml:"publish,omitempty"`
	Build            *BuildConfig   `yaml:"build,omitempty"`
	Documentation    string         `yaml:"documentation"`
	Website          string         `yaml:"website"`
	Repository       string         `yaml:"repository"`
	Contributors     string         `yaml:"contributors"`
	Standard         string         `yaml:"standard"`
	License          string         `yaml:"license"`
	Dependencies     Dependencies   `yaml:"dependencies"`
	TestDependencies Dependencies   `yaml:"test_dependencies"`
	Tags             []string       `yaml:"tags,omitempty"`
}

Manifest is the main configuration structure for C3PM.

func Load

func Load(path string) (Manifest, error)

Load reads the file located at the given path, and stores its contents in a new Manifest struct.

func New

func New() Manifest

New returns the default manifest values.

func (*Manifest) Save

func (m *Manifest) Save(destination string) error

Save writes the current Manifest struct into the destination path.

func (*Manifest) Targets

func (m *Manifest) Targets() []string

Targets returns the CMake targets to use. TODO: delete this

type PublishConfig added in v0.1.0

type PublishConfig struct {
	IncludeDirs []string `yaml:"include_dirs,omitempty"`
	Include     []string `yaml:"include,omitempty"`
	Exclude     []string `yaml:"exclude,omitempty"`
}

type Type

type Type string

Type holds the kind of project to manage.

func TypeFromString

func TypeFromString(t string) (Type, error)

TypeFromString creates a Type instance from a corresponding string.

func (Type) String

func (t Type) String() string

String returns the string representation of a Type

func (*Type) WriteAnswer

func (t *Type) WriteAnswer(name string, value interface{}) (err error)

WriteAnswer allows type to be used in survey questions

type Version

type Version struct {
	*semver.Version
}

Version holds the Semantic Versioning-compatible version of a package.

func VersionFromString

func VersionFromString(version string) (v Version, err error)

VersionFromString converts a string to a Version instance.

func (Version) MarshalYAML

func (v Version) MarshalYAML() (interface{}, error)

MarshalYAML is used to write a Version to a YAML file.

func (*Version) UnmarshalYAML

func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is used to read a Version from a YAML file.

func (*Version) WriteAnswer

func (v *Version) WriteAnswer(name string, value interface{}) (err error)

WriteAnswer allows type to be used in survey questions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL