plugin

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDefinitionNotFound = errors.New("Definition file not found")

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name          string                 `json:"name"`
	Requirements  []string               `json:"requirements"`
	Configuration *jsonschema.RootSchema `json:"configuration"`
}

Definition defines the plugin.yml file that each plugin has

func LoadDefinitionFromDir

func LoadDefinitionFromDir(dir string) (*Definition, error)

LoadDefinitionFromDir looks in a directory for either a plugin.json or a plugin.yml

func ParseDefinition

func ParseDefinition(b []byte) (*Definition, error)

ParseDefinition parses either yaml or json bytes into a Definition

type Plugin

type Plugin struct {
	// Where the plugin can be found (can either be a file system path, or
	// a git repository)
	Location string

	// The version of the plugin that should be running
	Version string

	// The clone method
	Scheme string

	// Any authentication attached to the repostiory
	Authentication string

	// Configuration for the plugin
	Configuration map[string]interface{}
}

func CreateFromJSON

func CreateFromJSON(j string) ([]*Plugin, error)

Given a JSON structure, convert it to an array of plugins

func CreatePlugin

func CreatePlugin(location string, config map[string]interface{}) (*Plugin, error)

func (*Plugin) ConfigurationToEnvironment

func (p *Plugin) ConfigurationToEnvironment() (*env.Environment, error)

Converts the plugin configuration values to environment variables

func (*Plugin) Identifier

func (p *Plugin) Identifier() (string, error)

Returns and ID for the plugin that can be used as a folder name

func (*Plugin) Label

func (p *Plugin) Label() string

Pretty name for the plugin

func (*Plugin) Name

func (p *Plugin) Name() string

Returns the name of the plugin

func (*Plugin) Repository

func (p *Plugin) Repository() (string, error)

Returns the repository host where the code is stored

func (*Plugin) RepositorySubdirectory

func (p *Plugin) RepositorySubdirectory() (string, error)

Returns the subdirectory path that the plugin is in

type ValidateResult

type ValidateResult struct {
	Errors []string
}

func (ValidateResult) Error

func (vr ValidateResult) Error() string

func (ValidateResult) Valid

func (vr ValidateResult) Valid() bool

type Validator

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

func (Validator) Validate

func (v Validator) Validate(def *Definition, config map[string]interface{}) ValidateResult

Jump to

Keyboard shortcuts

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