Documentation
¶
Index ¶
- func DoAllConditionsApply(context *app.Context, conditions []*configuration.Condition, hook string) bool
- func DoesAnyConditionApply(context *app.Context, conditions []*configuration.Condition, hook string) bool
- type ActionResult
- type ActionRunner
- type ConditionRunner
- type ConfigInfo
- type HookRunner
- type Initializer
- type Installer
- type Uninstaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoAllConditionsApply ¶
func DoesAnyConditionApply ¶
Types ¶
type ActionResult ¶
type ActionResult struct { Config *configuration.Action Status int RunErr error DispatchErr error Log *io.CollectorIO }
ActionResult is the way to communicate the result of an action to the hook runner It contains the action output and errors It also knows if all events where dispatched correctly If you execute actions concurrently the channel is collection action results
func NewActionResult ¶
func NewActionResult(config *configuration.Action, status int, run, dispatch error, log *io.CollectorIO) *ActionResult
type ActionRunner ¶
type ActionRunner struct {
// contains filtered or unexported fields
}
ActionRunner executes an action Besides executing the action the runner triggers the relevant events
func NewActionRunner ¶
func NewActionRunner( appIO io.IO, conf *configuration.Configuration, repo git.Repo, dispatcher *events.Dispatcher, ) *ActionRunner
func (*ActionRunner) Run ¶
func (a *ActionRunner) Run(hook string, action *configuration.Action) *ActionResult
Run executes the action and returns an ActionResult struct
func (*ActionRunner) RunAsync ¶
func (a *ActionRunner) RunAsync(hook string, action *configuration.Action, channel chan *ActionResult)
RunAsync run the action concurrently and send the result to a channel
type ConditionRunner ¶
type ConditionRunner struct {
// contains filtered or unexported fields
}
ConditionRunner executes conditions If the execution is successful the condition is considered true.
func NewConditionRunner ¶
func NewConditionRunner(cIO io.IO, conf *configuration.Configuration, repo git.Repo) *ConditionRunner
func (*ConditionRunner) Run ¶
func (c *ConditionRunner) Run(hook string, condition *configuration.Condition) bool
Run executes the ConditionRunner
type ConfigInfo ¶
type ConfigInfo struct {
// contains filtered or unexported fields
}
ConfigInfo blah blah
func NewConfigInfo ¶
func NewConfigInfo(appIO io.IO, config *configuration.Configuration, repo git.Repo) *ConfigInfo
func (*ConfigInfo) Display ¶
func (c *ConfigInfo) Display(what string, show bool)
Display allows to change the displayed details
func (*ConfigInfo) Extended ¶
func (c *ConfigInfo) Extended(ext bool)
Extended gives you an installation status
func (*ConfigInfo) Hook ¶
func (c *ConfigInfo) Hook(hook string)
Hook restricts the info to show only information of given hooks
func (*ConfigInfo) Run ¶
func (c *ConfigInfo) Run() error
type HookRunner ¶
type HookRunner struct {
// contains filtered or unexported fields
}
HookRunner executes all configured actions for the executed hook
func NewHookRunner ¶
func NewHookRunner(hook string, appIO io.IO, config *configuration.Configuration, repo git.Repo) *HookRunner
type Initializer ¶
type Initializer struct {
// contains filtered or unexported fields
}
Initializer creates an empty CaptainHook configuration file Is used to set up a empty dummy configuration
func NewInitializer ¶
func NewInitializer(appIO io.IO) *Initializer
func (*Initializer) Force ¶
func (i *Initializer) Force(force bool)
Force decides if the configuration file will be overwritten without asking By default this is false but can be changed with the `--force` option.
func (*Initializer) UseConfig ¶
func (i *Initializer) UseConfig(config string)
UseConfig sets the path to the configuration file By default this should be `captainhook.json` but can be changed via the --configuration option.
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer is responsible to write the hook files into your local .git/hooks directory Normally it makes sure you don't overwrite your existing git hooks. If you don't want to be bothered to acknowledge every hook you can use the Force function to activate the `force` mode
func NewInstaller ¶
func NewInstaller(appIO io.IO, config *configuration.Configuration, repo git.Repo) *Installer
func (*Installer) EnableBackup ¶
EnableBackup makes sure existing hooks will be moved away to keep a backup
func (*Installer) HookTemplate ¶
func (*Installer) OnlyEnabled ¶
OnlyEnabled makes sure you only install hooks that are activated in the configuration
func (*Installer) SkipExisting ¶
SkipExisting makes sure you don't overwrite existing hooks
type Uninstaller ¶
type Uninstaller struct {
// contains filtered or unexported fields
}
Uninstaller is responsible to delete the hook files from your local .git/hooks directory Normally it makes sure to ask for confirmation. If you don't want to be bothered to acknowledge every hook you can use the Force function to activate the `force` mode. If you are unsure use EnableBackup to create a {HOOK-FILE}.bak copy before deletion.
func NewUninstaller ¶
func NewUninstaller(appIO io.IO, config *configuration.Configuration, repo git.Repo) *Uninstaller
func (*Uninstaller) EnableBackup ¶
func (u *Uninstaller) EnableBackup(backup bool)
EnableBackup makes sure existing hooks will be moved away to keep a backup
func (*Uninstaller) Force ¶
func (u *Uninstaller) Force(force bool)
Force makes sure to remove all hooks without asking any questions