plugins

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPluginSourceFmt = "https://github.com/outblocks/cli-plugin-%s"
	DefaultAuthor          = "outblocks"
	A                      = runtime.GOOS + "_" + runtime.GOARCH
)

Variables

View Source
var (
	ErrPluginNotFound               = errors.New("plugin not found")
	ErrPluginNoMatchingVersionFound = errors.New("no matching version for plugin not found")
)
View Source
var GitHubRegex = regexp.MustCompile(`^https://github\.com/(?P<owner>[^/]+)/(?P<name>[^/]+)/?$`)

Functions

func CurrentArch

func CurrentArch() string

Types

type Action

type Action int
const (
	ActionDeploy Action = iota
	ActionRun
	ActionDNS
)

type DownloadedPlugin

type DownloadedPlugin struct {
	Path     string
	PathTemp bool
	Version  *semver.Version
}

type Downloader

type Downloader interface {
	Download(ctx context.Context, pi *pluginInfo) (*DownloadedPlugin, error)
	MatchingVersion(ctx context.Context, pi *pluginInfo) (matching, latest *semver.Version, err error)
}

type GitHubDownloader

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

func NewGitHubDownloader

func NewGitHubDownloader() *GitHubDownloader

func (*GitHubDownloader) Download

func (d *GitHubDownloader) Download(ctx context.Context, pi *pluginInfo) (*DownloadedPlugin, error)

func (*GitHubDownloader) MatchingVersion added in v0.1.2

func (d *GitHubDownloader) MatchingVersion(ctx context.Context, pi *pluginInfo) (matching, latest *semver.Version, err error)

type Loader

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

func NewLoader

func NewLoader(baseDir, pluginsCacheDir string) *Loader

func (*Loader) DownloadPlugin

func (l *Loader) DownloadPlugin(ctx context.Context, name string, verConstr *semver.Constraints, src string, lock *lockfile.Plugin) (*Plugin, error)

func (*Loader) LoadPlugin

func (l *Loader) LoadPlugin(ctx context.Context, name, src string, verConstr *semver.Constraints, lock *lockfile.Plugin) (*Plugin, error)

func (*Loader) MatchingVersion added in v0.1.2

func (l *Loader) MatchingVersion(ctx context.Context, name, src string, verConstr *semver.Constraints) (matching, latest *semver.Version, err error)

type Plugin

type Plugin struct {
	Name           string            `json:"name"`
	Author         string            `json:"author"`
	Usage          string            `json:"usage"`
	Description    string            `json:"description"`
	Cmd            map[string]string `json:"cmd"`
	Actions        []string          `json:"actions"`
	Hooks          []*PluginHooks    `json:"hooks"`
	Supports       []string          `json:"supports"`
	StateTypes     []string          `json:"state_types"`
	SupportedTypes []*PluginType     `json:"supported_types"`

	Path    string          `json:"-"`
	Version *semver.Version `json:"-"`
	// contains filtered or unexported fields
}

func (*Plugin) Client

func (p *Plugin) Client() *client.Client

func (*Plugin) HasAction

func (p *Plugin) HasAction(a Action) bool

func (*Plugin) Locked

func (p *Plugin) Locked() *lockfile.Plugin

func (*Plugin) Normalize

func (p *Plugin) Normalize() error

func (*Plugin) Prepare

func (p *Plugin) Prepare(ctx context.Context, log logger.Logger, projectName, projectPath string, props map[string]interface{}, yamlPrefix string, yamlData []byte) error

func (*Plugin) Stop

func (p *Plugin) Stop() error

func (*Plugin) SupportsApp

func (p *Plugin) SupportsApp(app string) bool

func (*Plugin) SupportsType

func (p *Plugin) SupportsType(typ, dep string, other map[string]interface{}) bool

func (*Plugin) Validate

func (p *Plugin) Validate() error

type PluginHooks

type PluginHooks struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

func (*PluginHooks) Validate

func (p *PluginHooks) Validate() error

type PluginMatch

type PluginMatch struct {
	Deploy string                 `json:"deploy"`
	Other  map[string]interface{} `yaml:"-,remain"`
}

type PluginType

type PluginType struct {
	Type  string       `json:"type"`
	Match *PluginMatch `json:"match"`
}

func (*PluginType) Validate

func (p *PluginType) Validate() error

type VCSDownloader

type VCSDownloader struct {
}

func NewVCSDownloader

func NewVCSDownloader() *VCSDownloader

func (*VCSDownloader) Download

func (d *VCSDownloader) Download(ctx context.Context, pi *pluginInfo) (*DownloadedPlugin, error)

func (*VCSDownloader) MatchingVersion added in v0.1.2

func (d *VCSDownloader) MatchingVersion(ctx context.Context, pi *pluginInfo) (matching, latest *semver.Version, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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