versionbump

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Code to automatically bump versions

Index

Constants

View Source
const (
	MAJOR = iota // MAJOR bump flag
	MINOR        // MINOR bump flag
	PATCH        // PATCH bump flag
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bump

type Bump interface {
	VersionRegex(regex *string) error
	Version() string
	BumpVersion(part int) error
}

func NewBumpFile

func NewBumpFile(path string) (Bump, error)

Opens a new bump file for reading. Note that the Bump interface is returned not BumpFile

type BumpFile

type BumpFile struct {
	Bump
	// contains filtered or unexported fields
}

Bump Version contained in a file. By default Do not instantiate using BumpFile instead use NewBumpFile()

func (*BumpFile) BumpVersion

func (b *BumpFile) BumpVersion(part int) error

Atomically writes the version to file. msg *string is not currently implimented

MAJOR version bump:

f.BumpVersion(internal.MAJOR)
f.BumpVersion(0)

MINOR version bump:

f.BumpVersion(internal.MINOR)
f.BumpVersion(1)

PATCH version bump:

f.BumpVersion(internal.PATCH)
f.BumpVersion(2)

func (*BumpFile) Version

func (b *BumpFile) Version() string

Get the current version

type Version

type Version struct {
	Patch int
	// contains filtered or unexported fields
}

Version section struct The version will follow semver.

func NewVersion

func NewVersion(major, minor, patch string, msg *string) Version

Create version struct from parsed string

func (Version) BumpMajor

func (v Version) BumpMajor() Version

Bump major version and create new version

func (Version) BumpMinor

func (v Version) BumpMinor() Version

Bump minor version and create new version

func (Version) BumpPatch

func (v Version) BumpPatch() Version

Bump patch version and create new version

func (Version) Version

func (v Version) Version() string

Return Version as a String

Jump to

Keyboard shortcuts

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