plugdeps

package
v0.0.0-...-463c03f Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingConfig = fmt.Errorf("could not find a buffalo-plugins config file at %s", ConfigPath(meta.New(".")))

ErrMissingConfig is if config/buffalo-plugins.toml file is not found. Use plugdeps#On(app) to test if plugdeps are being used

Functions

func ConfigPath

func ConfigPath(app meta.App) string

ConfigPath returns the path to the config/buffalo-plugins.toml file relative to the app

func On

func On(app meta.App) bool

On checks for the existence of config/buffalo-plugins.toml if this file exists its contents will be used to list plugins. If the file is not found, then the BUFFALO_PLUGIN_PATH and ./plugins folders are consulted.

Types

type Command

type Command struct {
	Name     string    `toml:"name" json:"name"`
	Flags    []string  `toml:"flags,omitempty" json:"flags,omitempty"`
	Commands []Command `toml:"command,omitempty" json:"commands,omitempty"`
}

Command is the plugin command you want to control further

func (Command) String

func (p Command) String() string

String implementation of fmt.Stringer

type Plugin

type Plugin struct {
	Binary   string         `toml:"binary" json:"binary"`
	GoGet    string         `toml:"go_get,omitempty" json:"go_get,omitempty"`
	Local    string         `toml:"local,omitempty" json:"local,omitempty"`
	Commands []Command      `toml:"command,omitempty" json:"commands,omitempty"`
	Tags     meta.BuildTags `toml:"tags,omitempty" json:"tags,omitempty"`
}

Plugin represents a Go plugin for Buffalo applications

func (Plugin) String

func (p Plugin) String() string

String implementation of fmt.Stringer

type Plugins

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

Plugins manages the config/buffalo-plugins.toml file as well as the plugins available from the file.

func List

func List(app meta.App) (*Plugins, error)

List all of the plugins the application depeneds on. Will return ErrMissingConfig if the app is not using config/buffalo-plugins.toml to manage their plugins. Use plugdeps#On(app) to test if plugdeps are being used.

func New

func New() *Plugins

New returns a configured *Plugins value

func (*Plugins) Add

func (plugs *Plugins) Add(pp ...Plugin)

Add plugin(s) to the list of dependencies

func (*Plugins) Decode

func (plugs *Plugins) Decode(r io.Reader) error

Decode the list of plugins, in TOML format, from the reader

func (*Plugins) Encode

func (plugs *Plugins) Encode(w io.Writer) error

Encode the list of plugins, in TOML format, to the reader

func (*Plugins) List

func (plugs *Plugins) List() []Plugin

List of dependent plugins listed in order of Plugin.String()

func (*Plugins) Remove

func (plugs *Plugins) Remove(pp ...Plugin)

Remove plugin(s) from the list of dependencies

Jump to

Keyboard shortcuts

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