svermaker

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 1 Imported by: 1

README

#Svermaker

CircleCI

Go Report Card

Purpose

Tooling to help with semver versioning of git projects

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultProjectVersion = ProjectVersion{Current: Version{0, 1, 0, nil, nil}, Next: Version{0, 1, 0, nil, nil}}

DefaultProjectVersion is the init value for a new repo

Functions

This section is empty.

Types

type BuildHelper

type BuildHelper interface {
	MakeTags(p ProjectVersion, buildMetadata []string) error
}

BuildHelper is the api to write a helper file for build tools

type Manipulator

type Manipulator interface {
	Bump(semver Version, component SemverComponent) (Version, error)
	SetPrerelease(semver Version, prerelease []PRVersion) (Version, error)
	SetMetadata(semver Version, metadata []string) (Version, error)
	MakePrerelease(s ...string) ([]PRVersion, error)
	Create(s string) (*Version, error)
	Compare(v1 Version, v2 Version) int
}

Manipulator is the api to change versions

type PRVersion

type PRVersion struct {
	VersionStr string
	VersionNum uint64
	IsNum      bool
}

PRVersion represents a PreRelease Version

func (PRVersion) String

func (v PRVersion) String() string

PreRelease version to string

type ProjectVersion

type ProjectVersion struct {
	Current Version
	Next    Version
}

ProjectVersion holds the current and next version identifier

type ProjectVersionService

type ProjectVersionService interface {
	Init() (*ProjectVersion, error)
	GetCurrent() (*Version, error)
	Get() (*ProjectVersion, error)
	Bump(component SemverComponent, prerelease []PRVersion) (*ProjectVersion, error)
	Release() (*ProjectVersion, error)
}

ProjectVersionService is the api for the service

type SemverComponent

type SemverComponent int8

SemverComponent is the base of the enum

const (
	PATCH SemverComponent = iota
	MINOR
	MAJOR
)

Semvar component enum

type Serializer

type Serializer interface {
	Serialize(p ProjectVersion) error
	Deserialize() (*ProjectVersion, error)
	Exists() bool
}

Serializer is an interface to write and read ProjectVersions

type Version

type Version struct {
	Major uint64
	Minor uint64
	Patch uint64
	Pre   []PRVersion
	Build []string //No Precedence
}

Version represents a semver compatible version

func (Version) String

func (v Version) String() string

Version to string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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