buffalo: github.com/gobuffalo/buffalo/plugins Index | Files | Directories

package plugins

import "github.com/gobuffalo/buffalo/plugins"

Index

Package Files

cache.go command.go decorate.go events.go log.go plugins.go

Constants

const (
    EvtSetupStarted  = "buffalo-plugins:setup:started"
    EvtSetupErr      = "buffalo-plugins:setup:err"
    EvtSetupFinished = "buffalo-plugins:setup:finished"
)

Variables

var CachePath = func() string {
    home := "."
    if usr, err := user.Current(); err == nil {
        home = usr.HomeDir
    }
    return filepath.Join(home, ".buffalo", "plugin.cache")
}()

CachePath returns the path to the plugins cache

var ErrPlugMissing = fmt.Errorf("plugin missing")

ErrPlugMissing error for when a plugin is missing

func Decorate Uses

func Decorate(c Command) *cobra.Command

Decorate setup cobra Commands for plugins

func LookPath Uses

func LookPath(s string) (string, error)

LookPath for plugin

type Command Uses

type Command struct {
    // Name "foo"
    Name string `json:"name"`
    // UseCommand "bar"
    UseCommand string `json:"use_command"`
    // BuffaloCommand "generate"
    BuffaloCommand string `json:"buffalo_command"`
    // Description "generates a foo"
    Description string   `json:"description,omitempty"`
    Aliases     []string `json:"aliases,omitempty"`
    Binary      string   `json:"-"`
    Flags       []string `json:"flags,omitempty"`
    // Filters events to listen to ("" or "*") is all events
    ListenFor string `json:"listen_for,omitempty"`
}

Command that the plugin supplies

type Commands Uses

type Commands []Command

Commands is a slice of Command

type List Uses

type List map[string]Commands

List maps a Buffalo command to a slice of Command

func Available Uses

func Available() (List, error)

Available plugins for the `buffalo` command. It will look in $GOPATH/bin and the `./plugins` directory. This can be changed by setting the $BUFFALO_PLUGIN_PATH environment variable.

Requirements: * file/command must be executable * file/command must start with `buffalo-` * file/command must respond to `available` and return JSON of

plugins.Commands{}

Limit full path scan with direct plugin path

If a file/command doesn't respond to being invoked with `available` within one second, buffalo will assume that it is unable to load. This can be changed by setting the $BUFFALO_PLUGIN_TIMEOUT environment variable. It must be set to a duration that `time.ParseDuration` can process.

Directories

PathSynopsis
packrdYou can use the "packr2 clean" command to clean up this, and any other packr generated files.
plugcmds
plugdeps

Package plugins imports 22 packages (graph) and is imported by 27 packages. Updated 2019-07-28. Refresh now. Tools for package owners.