version

package
v0.0.0-...-a398c15 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitType

type CommitType interface {
	GetAll() []string
	GetMajorUpgrade() []string
	GetMinorUpgrade() []string
	GetPatchUpgrade() []string
	GetSkipVersioning() []string
	GetCommitChangeType(commitMessage string) (string, error)
}

type Logger

type Logger interface {
	Info(s string, args ...interface{})
	Error(s string, args ...interface{})
}

type PrintElapsedTime

type PrintElapsedTime func(functionName string) func()

type VersionControl

type VersionControl struct {
	// contains filtered or unexported fields
}

func NewVersionControl

func NewVersionControl(log Logger, printElapsedTime PrintElapsedTime, commitType CommitType) *VersionControl

NewVersionControl is the version control constructor

func (*VersionControl) GetNewVersion

func (v *VersionControl) GetNewVersion(commitMessage string, currentVersion string) (string, error)

GetNewVersion upgrade the current version based on the commitChangeType. It calls the getUpgradeType function to define where to upgrade the version (MAJOR.MINOR.PATCH). Args:

commitMessage (string): The commit message.
currentVersion (string): Current release version. I.e.: 2.1.1.

Returns:

string: It will return a string with the new version.
	I.e.:
	1 - If the current version is 2.1.1 and the update type is MAJOR it will return 3.0.0
	2 - If the current version is 2.1.1 and the update type is MINOR it will return 2.2.0
	1 - If the current version is 2.1.1 and the update type is PATCH it will return 2.1.2
error: It returns an error when something wrong happen.

func (*VersionControl) MustSkipVersioning

func (v *VersionControl) MustSkipVersioning(commitMessage string) bool

MustSkip compare commit type with skip types (CommitTypeSkipVersioning) to avoid upgrading version. I.e.:

commitChangeType: [skip]

Output: true

Jump to

Keyboard shortcuts

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