configuration

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type GookmeConfiguration

type GookmeConfiguration struct {
	Global GookmeGlobalConfiguration
	Hooks  []Hook
}

func LoadConfiguration

func LoadConfiguration(directory string, hookType HookType) (*GookmeConfiguration, error)

type GookmeGlobalConfiguration

type GookmeGlobalConfiguration struct {
	// The behaviour to use when there are modified files at the end of the hook.
	OnModifiedFiles *OnModifiedFileBehaviour `json:"onModifiedFiles,omitempty"`
}

Global configuration for the Gookme tool. Behaviours defined here will be used for all hooks to run.

The Gookme global configuration is a JSON file named .gookme.json, located at the root of the repository.

func DefaultGlobalConfiguration

func DefaultGlobalConfiguration() *GookmeGlobalConfiguration

func LoadGlobalConfiguration

func LoadGlobalConfiguration(directory string) (*GookmeGlobalConfiguration, error)

type Hook

type Hook struct {
	Path  string
	Files []string
	Steps []Step
}

func LoadHooksConfiguration

func LoadHooksConfiguration(directory string, hookType HookType) ([]Hook, error)

type HookConfiguration

type HookConfiguration struct {
	Steps []StepConfiguration `json:"steps"`
}

Configuration for a hook.

The Gookme hook configuration is a JSON file named .{hookType}.json, located in a subfolder or at the root of the repository. The hookType is the type of Git hook to attach the configuration to, such as pre-commit, post-merge, etc.

type HookFixture added in v0.5.0

type HookFixture struct {
	// contains filtered or unexported fields
}

func NewHookFixture added in v0.5.0

func NewHookFixture(path string) *HookFixture

func (*HookFixture) Copy added in v0.5.0

func (hf *HookFixture) Copy() *HookFixture

func (*HookFixture) ToHook added in v0.5.0

func (hf *HookFixture) ToHook() Hook

func (*HookFixture) WithFiles added in v0.5.0

func (hf *HookFixture) WithFiles(files ...string) *HookFixture

func (*HookFixture) WithStep added in v0.5.0

func (hf *HookFixture) WithStep(step ...*StepFixture) *HookFixture

type HookType

type HookType string
const (
	PreCommitHookType     HookType = "pre-commit"
	PrepareCommitHookType HookType = "prepare-commit-msg"
	CommitMsgHookType     HookType = "commit-msg"
	PostCommitHookType    HookType = "post-commit"
	PostMergeHookType     HookType = "post-merge"
	PostRewriteHookType   HookType = "post-rewrite"
	PreRebaseHookType     HookType = "pre-rebase"
	PostCheckoutHookType  HookType = "post-checkout"
	PrePushHookType       HookType = "pre-push"
)

type OnModifiedFileBehaviour

type OnModifiedFileBehaviour string
const (
	AddAndCommit OnModifiedFileBehaviour = "addAndCommit"
	Abort        OnModifiedFileBehaviour = "abort"
)

type Step

type Step struct {
	ID                  string
	Name                string
	Command             string
	ExecutedCommand     string
	OnlyOn              *string
	Serial              bool
	From                *string
	PackageRelativePath string
	Files               []string
}

type StepConfiguration

type StepConfiguration struct {
	// The named of the step. Displayed in the UI and used in it to index steps and hooks
	Name string `json:"name"`

	// The command that will be invoked in `execSync`
	Command string `json:"command"`

	// A pattern string describing which changed files will trigger this step
	OnlyOn *string `json:"onlyOn,omitempty"`

	// Should this step be awaited before starting the next one
	Serial *bool `json:"serial,omitempty"`

	// Does this step extend a shared step
	From *string `json:"from,omitempty"`
}

Configuration for a single step in a hook.

type StepFixture added in v0.5.0

type StepFixture struct {
	// contains filtered or unexported fields
}

func NewStepFixture added in v0.5.0

func NewStepFixture() *StepFixture

func (*StepFixture) Copy added in v0.5.0

func (sf *StepFixture) Copy() *StepFixture

func (*StepFixture) ToStep added in v0.5.0

func (sf *StepFixture) ToStep() *Step

func (*StepFixture) WithFiles added in v0.5.0

func (sf *StepFixture) WithFiles(files ...string) *StepFixture

func (*StepFixture) WithOnlyOn added in v0.5.0

func (sf *StepFixture) WithOnlyOn(onlyOn string) *StepFixture

Jump to

Keyboard shortcuts

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