Documentation ¶
Index ¶
- Constants
- func FindVersionsYamlFilesInPath(startingPath string) ([]string, error)
- func GetVersionsFilePath(modulePath string) (string, error)
- func PrintModuleInfo(path string)
- type KaeterModule
- type Metadata
- type SemVerBump
- type VersionIdentifier
- type VersionMetadata
- type VersionNumber
- type VersionString
- type Versions
Constants ¶
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 ¶
FindVersionsYamlFilesInPath recursively looks for versions.yaml files starting from the given path. Returns on the first error encountered.
func GetVersionsFilePath ¶
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 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 ¶
ReadFromFile reads a Versions object from the YAML file living at the passed path.
func UnmarshalVersions ¶
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 ¶
Marshal serializes this instance to YAML and returns the corresponding bytes
func (*Versions) SaveToFile ¶
SaveToFile saves this instances to a YAML file