client

package
v1.0.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const PackageCacheJSON string = "cache.json"

Variables

This section is empty.

Functions

This section is empty.

Types

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 *portercontext.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 {
	*portercontext.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 *portercontext.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 (*TestPackageManager) List

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

func (*TestPackageManager) Run

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

func (*TestPackageManager) Uninstall

type TestRunner

type TestRunner struct {
	*Runner
	TestContext *portercontext.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.

Jump to

Keyboard shortcuts

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