Documentation ¶
Index ¶
- Constants
- Variables
- func FindVersionsYamlFilesInPath(basePath string) ([]string, error)
- func GetVersionsFilePath(modulePath string) (string, error)
- func PrintModuleInfo(path string)
- type InitializationConfig
- 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
const InitRef = "INIT"
InitRef is the commit ref value used for initialize entries in kaeter modules.
Variables ¶
var ErrModuleDependencyPath = fmt.Errorf("modules: Invalid dependency path")
ErrModuleDependencyPath is generated when stats cannot be loaded for the dependency path in a kaeter module. Likely the path does not or no longer exists.
Functions ¶
func FindVersionsYamlFilesInPath ¶
FindVersionsYamlFilesInPath concurrently looks for versions.yaml files starting from the given path down each folder recursively.
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 InitializationConfig ¶
type InitializationConfig struct { InitChangelog bool InitReadme bool InitMakefile bool ModuleDir string ModuleID string ModulePath string VersioningScheme string Flavor string // contains filtered or unexported fields }
InitializationConfig holds the parameters that can be tweaked when initializing a new kaeter module.
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, 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, releaseData, 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 Initialize ¶
func Initialize(config *InitializationConfig) (*Versions, error)
Initialize initializes a kaeter modules with the required files based on the config typically the versions.yaml, a readme and a changelog.
func ReadFromFile ¶
ReadFromFile reads a Versions object from the YAML file living at the passed path.
func (*Versions) AddRelease ¶
func (v *Versions) AddRelease(refTime *time.Time, bumpType SemVerBump, userProvidedVersion, 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