config

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitChore = "chore" // Other changes

)

Commit types.

View Source
const (
	DefaultConfigFile = "version.yaml"
)

Default values.

Variables

View Source
var (

	// ErrConfigWarn is a config warning.
	ErrConfigWarn = errors.New("config warning")
)

Functions

func Init

func Init(opts ...func(options *Options))

Init initializes the configuration.

func SetForce

func SetForce()

SetForce sets force mode.

func SetURLFromGit

func SetURLFromGit(u string)

SetURLFromGit sets the remote repository URL from git.

Types

type BumpFile

type BumpFile struct {
	// File path.
	File fsys.File `yaml:"file"`
	// RegExp for string for search version.
	// If not will be found version regexp in strings from start to end.
	RegExp []string `yaml:"regexp"`
	// Start string for search version. Default: 0 (start of file).
	Start int `yaml:"start"`
	// End string for search version. If 0 will be searched to end of file.
	End int `yaml:"end"`
}

BumpFile is a file for bump.

func (BumpFile) HasPositions

func (f BumpFile) HasPositions() bool

HasPositions returns true if the file has start and end positions.

func (BumpFile) IsPredefinedJSON

func (f BumpFile) IsPredefinedJSON() bool

IsPredefinedJSON returns true if the file is predefined (composer.json or package.json). Path contains the file path.

type C

type C struct {
	// Version is a version of the application.
	Version version.V `yaml:"version"`
	// IsFileConfig is a flag that indicates that the configuration is from a file.
	IsFileConfig bool `yaml:"-"`
	// BackupChangedFiles is a flag that indicates that the changed files are backed up.
	Backup bool `yaml:"backupChanged"`
	// Before is a list of commands that are executed before the main command.
	Before []Command `yaml:"before"`
	// After is a list of commands that are executed after the main command.
	After []Command `yaml:"after"`
	// GitOptions is a git options.
	GitOptions gitOptions `yaml:"git"`
	// ChangelogOptions is a changelog options.
	ChangelogOptions changelogOptions `yaml:"changelog"`
	// Bump is a list of files for bump.
	Bump []BumpFile `yaml:"bump"`
	// contains filtered or unexported fields
}

C is a configuration file.

func Load

func Load(opts ...func(options *LoadArgs)) (C, error)

Load loads the configuration from config.yaml. Run after config.Init() in main.go.

func (C) BumpFiles

func (c C) BumpFiles() []BumpFile

BumpFiles returns a list of files for bump.

func (C) CommandsAfter

func (c C) CommandsAfter() []Command

CommandsAfter returns a list of commands that are executed after the main command.

func (C) CommandsBefore

func (c C) CommandsBefore() []Command

CommandsBefore returns a list of commands that are executed before the main command.

func (C) CommitTypes

func (c C) CommitTypes() []CommitName

CommitTypes returns a commit types for changelog.

func (C) Generate

func (c C) Generate() (err error)

Generate generates the configuration file.

func (C) Validate

func (c C) Validate() error

Validate validates the configuration.

type Command

type Command struct {
	// Cmd is a command.
	// Example: ["go", "build", "-o", "bin/app", "."]
	Cmd []string `yaml:"cmd"`
	// Flag to send bumped version in format 1.2.3 to command. Optional.
	VersionFlag string `yaml:"versionFlag"`
	// BreakOnError is a flag that indicates that the command is stopped if an error occurs.
	BreakOnError bool `yaml:"breakOnError"`
	// RunInDry is a flag that indicates that the command is run in dry mode.
	RunInDry bool `yaml:"runInDry"`
}

Command is a command for run before or after git commit.

func (Command) Args

func (c Command) Args(v version.V) []string

Args returns a command args.

func (Command) Name

func (c Command) Name() string

Name returns a command name.

func (Command) String

func (c Command) String() string

String returns a command string.

type CommitName

type CommitName struct {
	Type string `yaml:"type"`
	Name string `yaml:"name"`
}

CommitName is a commit type name.

type LoadArgs added in v1.0.10

type LoadArgs struct {
	RW configRW
}

LoadArgs is a load configuration arguments.

type Options

type Options struct {
	WorkDir               string
	Version               string
	AllowCommitDirty      bool
	AutoGenerateNextPatch bool
	AllowDowngrades       bool
	GenerateChangelog     bool
	ChangelogFileName     string
	ChangelogTitle        string
	ChangelogIssueHref    string
	ChangelogShowAuthor   bool
	ChangelogShowBody     bool
	Silent                bool
	DryRun                bool
	Backup                bool
	Force                 bool
	Verbose               bool
	ConfigFile            string

	TestingSkipDIInit bool
}

Options is a configuration options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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