Back to godoc.org

Package client

v0.29.1
Latest Go to latest

The latest major version is .

Published: Sep 23, 2020 | License: Apache-2.0 | Module: get.porter.sh/porter

Overview

Package client provides a package management client for Porter's mixins and plugins.

Index

Constants

const PackageCacheJSON string = "cache.json"

type FileSystem

type FileSystem struct {
	*config.Config

	// PackageType is the type of package managed by this instance of the
	// package manager. It must also correspond to the directory name in
	// PORTER_HOME.
	PackageType string

	// PreRun is executed before commands are run against a package, giving
	// consumers a chance to tweak the command first.
	PreRun pkgmgmt.PreRunHandler

	// BuildMetadata allows mixins/plugins to supply the proper struct that
	// represents its package metadata.
	BuildMetadata PackageMetadataBuilder
}

func NewFileSystem

func NewFileSystem(config *config.Config, pkgType string) *FileSystem

func (*FileSystem) BuildClientPath

func (fs *FileSystem) BuildClientPath(pkgDir string, name string) string

func (*FileSystem) GetMetadata

func (fs *FileSystem) GetMetadata(name string) (pkgmgmt.PackageMetadata, error)

func (*FileSystem) GetPackageDir

func (fs *FileSystem) GetPackageDir(name string) (string, error)

func (*FileSystem) GetPackagesDir

func (fs *FileSystem) GetPackagesDir() (string, error)

func (*FileSystem) Install

func (fs *FileSystem) Install(opts pkgmgmt.InstallOptions) error

func (*FileSystem) InstallFromFeedURL

func (fs *FileSystem) InstallFromFeedURL(opts pkgmgmt.InstallOptions) error

func (*FileSystem) InstallFromURL

func (fs *FileSystem) InstallFromURL(opts pkgmgmt.InstallOptions) error

func (*FileSystem) List

func (fs *FileSystem) List() ([]string, error)

func (*FileSystem) Run

func (fs *FileSystem) Run(pkgContext *context.Context, name string, commandOpts pkgmgmt.CommandOptions) error

func (*FileSystem) Uninstall

func (fs *FileSystem) Uninstall(opts pkgmgmt.UninstallOptions) error

type PackageInfo

type PackageInfo struct {
	Name    string `json:"name"`
	FeedURL string `json:"URL,omitempty"`
	URL     string `json:"url,omitempty"`
}

type PackageMetadataBuilder

type PackageMetadataBuilder func() pkgmgmt.PackageMetadata

type Runner

type Runner struct {
	*context.Context
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(pkgName, pkgDir string, runtime bool) *Runner

func (*Runner) Run

func (r *Runner) Run(commandOpts pkgmgmt.CommandOptions) error

func (*Runner) Validate

func (r *Runner) Validate() error

type TestPackageManager

type TestPackageManager struct {
	PkgType       string
	Packages      []pkgmgmt.PackageMetadata
	RunAssertions []func(pkgContext *context.Context, name string, commandOpts pkgmgmt.CommandOptions) error
}

TestPackageManager helps us test mixins/plugins in our unit tests without actually hitting any real executables on the file system.

func (*TestPackageManager) GetMetadata

func (p *TestPackageManager) GetMetadata(name string) (pkgmgmt.PackageMetadata, error)

func (*TestPackageManager) GetPackageDir

func (p *TestPackageManager) GetPackageDir(name string) (string, error)

func (*TestPackageManager) Install

func (p *TestPackageManager) Install(o pkgmgmt.InstallOptions) error

func (*TestPackageManager) List

func (p *TestPackageManager) List() ([]string, error)

func (*TestPackageManager) Run

func (p *TestPackageManager) Run(pkgContext *context.Context, name string, commandOpts pkgmgmt.CommandOptions) error

func (*TestPackageManager) Uninstall

func (p *TestPackageManager) Uninstall(o pkgmgmt.UninstallOptions) error

type TestRunner

type TestRunner struct {
	*Runner
	TestContext *context.TestContext
}

func NewTestRunner

func NewTestRunner(t *testing.T, name string, pkgType string, runtime bool) *TestRunner

NewTestRunner initializes a test runner, with the output buffered, and an in-memory file system.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier