changelog

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CommitRegex is used to parse the first line of commits
	CommitRegex = regexp.MustCompile(`^([^:\(]+?)(?:\(([^\)]*?)?\))?:(.*)`)
	// ClosesRegex is used to find any closes links
	ClosesRegex = regexp.MustCompile(`(?:Closes|Fixes|Resolves)\s((?:#(\d+)(?:,\s)?)+)`)
	// BreaksRegex is used to find any breaks links
	BreaksRegex = regexp.MustCompile(`(?:Breaks|Broke)\s((?:#(\d+)(?:,\s)?)+)`)
	// BreakingRegex is used to find anything that is a breaking change
	BreakingRegex = regexp.MustCompile(`(?i:breaking)`)
)
View Source
var DefaultOrder = []string{
	"Features",
	"Bug Fixes",
	"Performance",
	"Breaking Changes",
	"Unknown",
}

DefaultOrder defines the default order of sections in the change log

Functions

This section is empty.

Types

type ChangeLog

type ChangeLog struct {
	Repo         string `toml:"repo"`
	Version      string `toml:"version"`
	PatchVersion bool   `toml:"patch_ver"`
	Subtitle     string `toml:"subtitle"`
}

ChangeLog is a type for general configuration for producing a changelog

type Commit

type Commit struct {
	Hash      string
	Subject   string
	Component string
	Closes    []string
	Breaks    []string

	CommitType string
	// contains filtered or unexported fields
}

Commit is a struct for representing a git commit

func NewCommit

func NewCommit(hash, message string) *Commit

NewCommit creates a commit

func (*Commit) Summary

func (c *Commit) Summary(repo string, style linkStyle.Style) string

Summary generates a summary line for the commit used in the change log

type Commits

type Commits []Commit

Commits is a slice of Commit

func FilterCommits

func FilterCommits(commits Commits, grep string, includeAll bool) Commits

FilterCommits only keeps commits that are to be included in the changelog

func FormatCommits

func FormatCommits(commits Commits, sectionAliasMap SectionAliasMap) Commits

FormatCommits sets the CommitType on each commit from the given SectionAliasMap

func TitleCommitType

func TitleCommitType(commits Commits, sectionAliasMap SectionAliasMap) Commits

TitleCommitType sets the CommitType on each commit to the title case of itself.

This is used if you wanted change log sections that are not defined in a `.clog.toml`

type ComponentMap

type ComponentMap map[string]Commits

ComponentMap is a map whose keys are the components changed, and values are any associated commits

type Querier

type Querier interface {
	GetCommits(from, to string) (Commits, error)
	GetCommitRange(from, to time.Time) (Commits, error)
	GetOrigin() (string, error)
	GetLatestCommit() (string, error)
	GetLatestTag() (string, error)
	GetLatestTagVersion() (string, error)
	GetConfig() (io.Reader, error)
}

Querier is an interface for the functions needed to generate a changelog from a git repository

func NewGithubQuerier

func NewGithubQuerier(repo, token string) Querier

NewGithubQuerier queries Github for commits

func NewLocalQuerier

func NewLocalQuerier(gitDir, workTree string) Querier

NewLocalQuerier returns a querier that queries off of a local git repostiroy

type SectionAliasMap

type SectionAliasMap map[string][]string

SectionAliasMap is for associating commit prefixes to a section of the changelog

func MergeSectionAliasMaps

func MergeSectionAliasMaps(first SectionAliasMap, additional ...SectionAliasMap) SectionAliasMap

MergeSectionAliasMaps merges multiple maps into the first and returns the first

func NewSectionAliasMap

func NewSectionAliasMap() SectionAliasMap

NewSectionAliasMap returns the default map

func (SectionAliasMap) Grep

func (s SectionAliasMap) Grep() string

Grep produces a regex to search for lines starting with each section key

func (SectionAliasMap) SectionFor

func (s SectionAliasMap) SectionFor(alias string) string

SectionFor returns the section title for a given alias

type SectionMap

type SectionMap struct {
	Sections map[string]ComponentMap
	// contains filtered or unexported fields
}

SectionMap is a map whose keys are the commit type, and values are a ComponentMap

func NewSectionMap

func NewSectionMap(commits Commits) SectionMap

NewSectionMap returns a new SectionMap for the given commits

func (SectionMap) Order

func (s SectionMap) Order() []string

Order returns the order the sections will appear in the change log

func (*SectionMap) SetOrder

func (s *SectionMap) SetOrder(order []string)

SetOrder sets the order of the sections in the changelog. Any non-specified sections will be appended to the end alphabetically. Any sections that don't exist will be discarded.

"Unknown" section is always last

Jump to

Keyboard shortcuts

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