semver

package
v0.0.0-...-8f5952b Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Auto = "auto"

Auto strategy name for AutoStrategy.

View Source
const GitCommit = "git-commit"

GitCommit strategy name for GitCommitStrategy.

View Source
const Major = "major"

Major semver version level for major

View Source
const Minor = "minor"

Minor semver version level for minor

View Source
const Patch = "patch"

Patch semver version level for patch

Variables

View Source
var DefaultFeatureRegex = regexp.MustCompile(`(\[feature]|feature/)`)
View Source
var DefaultFixRegex = regexp.MustCompile(`(\[fix]|fix/)`)
View Source
var DefaultReleaseRegex = regexp.MustCompile(`(\[release]|release/)`)

Functions

This section is empty.

Types

type AutoStrategy

type AutoStrategy struct {
	GitCommitStrategy Strategy
	PatchStrategy     Strategy
}

AutoStrategy implementation of the Strategy interface. It makes use of several strategies and defaults to PatchStrategy as a last resort.

func NewAutoStrategy

func NewAutoStrategy(gitCommitStrategy Strategy) AutoStrategy

NewAutoStrategy creates a new AutoStrategy. Returns the new AutoStrategy.

func (AutoStrategy) Increment

func (autoStrategy AutoStrategy) Increment(targetVersion string) (nextVersion string, err error)

Increment increments a given version using the AutoStrategy. It will attempt to increment the target version with several strategies:

  1. the GitCommitStrategy
  2. the PatchStrategy

Returns the incremented version or an error if anything went wrong.

type GitCommitStrategy

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

GitCommitStrategy implementation of the Strategy interface. It makes use of several matching strategies based on git commit messages.

func NewGitCommitStrategy

func NewGitCommitStrategy(gitService git.Service) GitCommitStrategy

NewGitCommitStrategy creates a new GitCommitStrategy. Returns the new GitCommitStrategy.

func (GitCommitStrategy) GetMatchedStrategy

func (strategy GitCommitStrategy) GetMatchedStrategy(message string) (matched Strategy, err error)

GetMatchedStrategy gets the strategy that matches specific tokens within the git commit message. It returns the matched strategy.

func (GitCommitStrategy) Increment

func (strategy GitCommitStrategy) Increment(targetVersion string) (nextVersion string, err error)

Increment increments a given version using the GitCommitStrategy. Returns the incremented version.

type MajorStrategy

type MajorStrategy struct{}

MajorStrategy implementation of the Strategy interface. It makes use of the major level of semver versions.

func NewMajorStrategy

func NewMajorStrategy() MajorStrategy

NewMajorStrategy creates a new MajorStrategy. Returns the new MajorStrategy.

func (MajorStrategy) Increment

func (majorStrategy MajorStrategy) Increment(targetVersion string) (nextVersion string, err error)

Increment increments a given version using the MajorStrategy. Returns the incremented version.

type Manager

type Manager struct {
	GitService git.Service
}

func NewManager

func NewManager(gitService git.Service) Manager

func (Manager) GetStrategy

func (manager Manager) GetStrategy(name string) Strategy

type MinorStrategy

type MinorStrategy struct{}

MinorStrategy implementation of the Strategy interface. It makes use of the minor level of semver versions.

func NewMinorStrategy

func NewMinorStrategy() MinorStrategy

NewMinorStrategy creates a new MinorStrategy. Returns the new MinorStrategy.

func (MinorStrategy) Increment

func (minorStrategy MinorStrategy) Increment(targetVersion string) (nextVersion string, err error)

Increment increments a given version using the MinorStrategy. Returns the incremented version.

type PatchStrategy

type PatchStrategy struct{}

PatchStrategy implementation of the Strategy interface. It makes use of the patch level of semver versions.

func NewPatchStrategy

func NewPatchStrategy() PatchStrategy

NewPatchStrategy creates a new PatchStrategy. Returns the new PatchStrategy.

func (PatchStrategy) Increment

func (patchStrategy PatchStrategy) Increment(targetVersion string) (nextVersion string, err error)

Increment increments a given version using the PatchStrategy. Returns the incremented version.

type Strategy

type Strategy interface {
	Increment(targetVersion string) (nextVersion string, err error)
}

Strategy interface to increment a specific semver level.

Jump to

Keyboard shortcuts

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