bump

package
v0.0.0-...-2095b19 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	VersionChanges []VersionChange
	FileChanges    []FileChange
	RunShells      []RunShell
}

type Check

type Check struct {
	File *File
	Name string

	// bump: <name> /<re>/ <pipeline>
	PipelineLineNr   int
	CurrentREStr     string
	CurrentRE        *regexp.Regexp
	Pipeline         pipeline.Pipeline
	PipelineDuration time.Duration

	// bump: <name> command ...
	CommandShells []CheckShell
	// bump: <name> after ...
	AfterShells []CheckShell
	// bump: <name> message <title> <url>
	Messages []CheckMessage
	// bump: <name> link <title> <url>
	Links []CheckLink

	Latest   string
	Currents []Current
}

Check is a bump config line

func (*Check) HasUpdate

func (c *Check) HasUpdate() bool

HasUpdate returns true if any current version does not match Latest

func (*Check) String

func (c *Check) String() string
type CheckLink struct {
	Title  string
	URL    string
	File   *File
	LineNr int
}

type CheckMessage

type CheckMessage struct {
	Message string
	File    *File
	LineNr  int
}

type CheckShell

type CheckShell struct {
	Cmd    string
	File   *File
	LineNr int
}

type Current

type Current struct {
	File    *File
	LineNr  int
	Range   [2]int
	Version string
}

Current version found in a file

type File

type File struct {
	Name          string
	Text          []byte
	HasConfig     bool
	HasCurrents   bool
	HasNoVersions bool // for Bumpfile
}

File is file with config or versions

type FileChange

type FileChange struct {
	File    *File
	NewText string
	Diff    string
}

type FileSet

type FileSet struct {
	Files       []*File
	Filters     []filter.NamedFilter
	Checks      []*Check
	SkipCheckFn func(c *Check) bool
}

FileSet is a set of File:s, filters and checks found in files

func NewBumpFileSet

func NewBumpFileSet(
	os OS,
	filters []filter.NamedFilter,
	bumpfile string,
	filenames []string) (*FileSet, []error)

NewBumpFileSet creates a new BumpFileSet

func (*FileSet) CommandEnv

func (fs *FileSet) CommandEnv(check *Check) []string

func (*FileSet) Latest

func (fs *FileSet) Latest() []error

Latest run all pipelines to get latest version

func (*FileSet) Lint

func (fs *FileSet) Lint() []error

Lint configuration

func (*FileSet) Replace

func (fs *FileSet) Replace(file *File) []byte

Replace current with latest versions in text

func (*FileSet) SelectedChecks

func (fs *FileSet) SelectedChecks() []*Check

SelectedChecks returns selected checks based on SkipCheckFn

func (*FileSet) UpdateActions

func (fs *FileSet) UpdateActions() (Actions, []error)

type OS

type OS interface {
	Args() []string
	Getenv(name string) string
	Stdout() io.Writer
	Stderr() io.Writer
	WriteFile(filename string, data []byte) error
	ReadFile(filename string) ([]byte, error)
	Glob(pattern string) ([]string, error)
	Shell(cmd string, env []string) error
	Exec(args []string, env []string) error
}

type RunShell

type RunShell struct {
	Check *Check
	Cmd   string
	Env   []string
}

type VersionChange

type VersionChange struct {
	Check    *Check
	Currents []Current
}

Jump to

Keyboard shortcuts

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