pkgmgmt

package
v0.23.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 5 Imported by: 28

Documentation

Overview

Package pkgmgmt implements the backing package management used by mixins and plugins.

Index

Constants

View Source
const FileExt = ""

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandOptions

type CommandOptions struct {
	// Runtime specifies if the client or runtime executable should be targeted.
	Runtime bool

	// Command to pass to the package.
	Command string

	// Input to pipe to stdin.
	Input string

	// File argument to specify as --file.
	File string

	// PreRun allows the caller to tweak the command before it is executed.
	// This is only necessary if being called directly from a runner, if
	// using a PackageManager, this is set for you.
	PreRun PreRunHandler
}

CommandOptions is data necessary to execute a command against a package (mixin or plugin).

type InstallOptions

type InstallOptions struct {
	Name    string
	URL     string
	FeedURL string
	Version string

	DefaultFeedURL string
	// contains filtered or unexported fields
}

func (*InstallOptions) GetParsedFeedURL

func (o *InstallOptions) GetParsedFeedURL() url.URL

func (*InstallOptions) GetParsedURL

func (o *InstallOptions) GetParsedURL() url.URL

GetParsedURL returns a copy of of the parsed URL that is safe to modify.

func (*InstallOptions) Validate

func (o *InstallOptions) Validate(args []string) error

type Metadata

type Metadata struct {
	// Name of package.
	Name string `json:"name"`
	// VersionInfo for the package.
	VersionInfo
}

Metadata about an installed package.

func (Metadata) GetName

func (m Metadata) GetName() string

GetName of the installed package.

func (Metadata) GetVersionInfo

func (m Metadata) GetVersionInfo() VersionInfo

GetVersionInfo for the installed package.

type PackageManager

type PackageManager interface {
	List() ([]string, error)
	GetPackageDir(name string) (string, error)
	GetMetadata(name string) (PackageMetadata, error)
	Install(InstallOptions) error
	Uninstall(UninstallOptions) error

	// Run a command against the installed package.
	Run(pkgContext *context.Context, name string, commandOpts CommandOptions) error
}

PackageManager handles searching, installing and communicating with packages.

type PackageMetadata

type PackageMetadata interface {
	// GetName of the installed package.
	GetName() string

	// GetVersionInfo for the installed package.
	GetVersionInfo() VersionInfo
}

PackageMetadata is a common interface for packages managed by Porter.

type PreRunHandler

type PreRunHandler func(command string, cmd *exec.Cmd)

type UninstallOptions

type UninstallOptions struct {
	Name string
}

func (*UninstallOptions) Validate

func (o *UninstallOptions) Validate(args []string) error

type VersionInfo

type VersionInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Author  string `json:"author,omitempty"`
}

VersionInfo contains metadata from running the version command against the client executable.

Directories

Path Synopsis
Package client provides a package management client for Porter's mixins and plugins.
Package client provides a package management client for Porter's mixins and plugins.
Package feed helps work with a Porter package feed (mixin or plugin).
Package feed helps work with a Porter package feed (mixin or plugin).

Jump to

Keyboard shortcuts

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