modules

package
v0.0.0-...-4d54ae9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SemVer       = "semver"       // Semantic Versioning
	CalVer       = "calver"       // Calendar Versioning, using the YY.MM.MICRO convention
	AnyStringVer = "anystringver" // Anything the user wants that matches [a-zA-Z0-9.+_~@-]+
)

Supported Versioning schemes

Variables

This section is empty.

Functions

func FindVersionsYamlFilesInPath

func FindVersionsYamlFilesInPath(startingPath string) ([]string, error)

FindVersionsYamlFilesInPath recursively looks for versions.yaml files starting from the given path. Returns on the first error encountered.

func GetVersionsFilePath

func GetVersionsFilePath(modulePath string) (string, error)

GetVersionsFilePath checks if the passed path is a directory, then:

  • checks if there is a versions.yml or .yaml file, and appends the existing one to the abspath if so
  • appends 'versions.yaml' to it if there is none.

func PrintModuleInfo

func PrintModuleInfo(path string)

PrintModuleInfo outputs info about a module at the given relative path in pretty format, if said module exists.

Types

type KaeterModule

type KaeterModule struct {
	ModuleID     string            `json:"id"`
	ModulePath   string            `json:"path"`
	ModuleType   string            `json:"type"`
	Annotations  map[string]string `json:"annotations,omitempty"`
	AutoRelease  string            `json:"autoRelease,omitempty"`
	Dependencies []string          `json:"dependencies,omitempty"`
}

KaeterModule contains information about a single module

func GetKaeterModules

func GetKaeterModules(gitRoot string) (modules []KaeterModule, err error)

GetKaeterModules searches the repo for all Kaeter modules. A Kaeter module is identified by having a versions.yaml file that is parseable by the Kaeter tooling.

type Metadata

type Metadata struct {
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

Metadata olds the parsed Annotations from versions.yaml if present.

type SemVerBump

type SemVerBump int

SemVerBump defines the options for semver bumps, default to patch, and allow major, minor.

const (
	// BumpPatch bumps the patch version (z) number (default)
	BumpPatch SemVerBump = iota // 0
	// BumpMinor bumps the minor version (y) number
	BumpMinor // 1
	// BumpMajor bumps the major version (x) number
	BumpMajor // 2
)

type VersionIdentifier

type VersionIdentifier interface {
	String() string
}

VersionIdentifier represents a 'version number' when SemVer/CalVer are in use or an arbitrary string otherwise.

func UnmarshalVersionString

func UnmarshalVersionString(versionStr string, versioningScheme string) (VersionIdentifier, error)

UnmarshalVersionString builds a VersionIdentifier struct from a string (x.y.z)

type VersionMetadata

type VersionMetadata struct {
	Number    VersionIdentifier
	Timestamp time.Time
	CommitID  string
}

VersionMetadata contains some basic information assorted to a version number

func UnmarshalVersionMetadata

func UnmarshalVersionMetadata(versionStr string, releaseData string, versioningScheme string) (*VersionMetadata, error)

UnmarshalVersionMetadata builds a VersionMetadata struct from the two strings containing the raw version and release data

type VersionNumber

type VersionNumber struct {
	semver.Version
}

VersionNumber compose a semver.Version

func NewVersion

func NewVersion(major, minor, micro uint64) *VersionNumber

NewVersion creates a Major.Minor.Patch VersionNumber

func (*VersionNumber) String

func (vn *VersionNumber) String() string

type VersionString

type VersionString struct {
	Version string
}

VersionString a version represented by an arbitrary string

func (VersionString) String

func (vs VersionString) String() string

type Versions

type Versions struct {
	ID               string             `yaml:"id"`
	ModuleType       string             `yaml:"type"`
	VersioningType   string             `yaml:"versioning"`
	ReleasedVersions []*VersionMetadata `yaml:"versions"`
	Metadata         *Metadata          `yaml:"metadata,omitempty"`
	Dependencies     []string           `yaml:"dependencies,omitempty"`
	// contains filtered or unexported fields
}

Versions is a fully unmarshalled representation of a versions file

func Initialise

func Initialise(modulePath string, moduleID string, versioningScheme string, initReadme bool, initChangelog bool) (*Versions, error)

Initialize initializes a versions.yaml file at the specified path and a module identified with 'moduleId'. path should point to the module's directory.

func ReadFromFile

func ReadFromFile(versionsPath string) (*Versions, error)

ReadFromFile reads a Versions object from the YAML file living at the passed path.

func UnmarshalVersions

func UnmarshalVersions(bytes []byte) (*Versions, error)

UnmarshalVersions reads a high level Versions object from the passed bytes.

func (*Versions) AddRelease

func (v *Versions) AddRelease(refTime *time.Time, bumpType SemVerBump, userProvidedVersion string, commitID string) (*VersionMetadata, error)

AddRelease adds a new release to this Versions instance. Note that this does not yet update the YAML file from which this object may have been created from. Note if userProvidedVersion is set it will prime over any semantic versionin bump option.

func (*Versions) Marshal

func (v *Versions) Marshal() ([]byte, error)

Marshal serializes this instance to YAML and returns the corresponding bytes

func (*Versions) SaveToFile

func (v *Versions) SaveToFile(versionsPath string) error

SaveToFile saves this instances to a YAML file

Jump to

Keyboard shortcuts

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