Documentation ¶
Overview ¶
Package client provides a package management client for Porter's mixins and plugins.
Index ¶
- Constants
- type FileSystem
- func (fs *FileSystem) BuildClientPath(pkgDir string, name string) string
- func (fs *FileSystem) GetMetadata(ctx context.Context, name string) (pkgmgmt.PackageMetadata, error)
- func (fs *FileSystem) GetPackageDir(name string) (string, error)
- func (fs *FileSystem) GetPackagesDir() (string, error)
- func (fs *FileSystem) Install(ctx context.Context, opts pkgmgmt.InstallOptions) error
- func (fs *FileSystem) InstallFromFeedURL(ctx context.Context, opts pkgmgmt.InstallOptions) error
- func (fs *FileSystem) InstallFromURL(ctx context.Context, opts pkgmgmt.InstallOptions) error
- func (fs *FileSystem) List() ([]string, error)
- func (fs *FileSystem) Run(ctx context.Context, pkgContext *portercontext.Context, name string, ...) error
- func (fs *FileSystem) Uninstall(ctx context.Context, opts pkgmgmt.UninstallOptions) error
- type PackageInfo
- type PackageMetadataBuilder
- type Runner
- type TestPackageManager
- func (p *TestPackageManager) GetCalled(mixin string) int
- func (p *TestPackageManager) GetMetadata(ctx context.Context, name string) (pkgmgmt.PackageMetadata, error)
- func (p *TestPackageManager) GetPackageDir(name string) (string, error)
- func (p *TestPackageManager) Install(ctx context.Context, opts pkgmgmt.InstallOptions) error
- func (p *TestPackageManager) List() ([]string, error)
- func (p *TestPackageManager) Run(ctx context.Context, pkgContext *portercontext.Context, name string, ...) error
- func (p *TestPackageManager) Uninstall(ctx context.Context, opts pkgmgmt.UninstallOptions) error
- type TestRunner
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(ctx context.Context, 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(ctx context.Context, opts pkgmgmt.InstallOptions) error
func (*FileSystem) InstallFromFeedURL ¶
func (fs *FileSystem) InstallFromFeedURL(ctx context.Context, opts pkgmgmt.InstallOptions) error
func (*FileSystem) InstallFromURL ¶
func (fs *FileSystem) InstallFromURL(ctx context.Context, opts pkgmgmt.InstallOptions) error
func (*FileSystem) List ¶
func (fs *FileSystem) List() ([]string, error)
func (*FileSystem) Run ¶
func (fs *FileSystem) Run(ctx context.Context, pkgContext *portercontext.Context, name string, commandOpts pkgmgmt.CommandOptions) error
func (*FileSystem) Uninstall ¶
func (fs *FileSystem) Uninstall(ctx context.Context, opts pkgmgmt.UninstallOptions) error
type PackageInfo ¶
type PackageMetadataBuilder ¶
type PackageMetadataBuilder func() pkgmgmt.PackageMetadata
type Runner ¶
type Runner struct { *portercontext.Context // contains filtered or unexported fields }
type TestPackageManager ¶
type TestPackageManager struct { PkgType string Packages []pkgmgmt.PackageMetadata RunAssertions []func(pkgContext *portercontext.Context, name string, commandOpts pkgmgmt.CommandOptions) error // contains filtered or unexported fields }
TestPackageManager helps us test mixins/plugins in our unit tests without actually hitting any real executables on the file system.
func (*TestPackageManager) GetCalled ¶ added in v1.0.1
func (p *TestPackageManager) GetCalled(mixin string) int
GetCalled tracks how many times each package was called
func (*TestPackageManager) GetMetadata ¶
func (p *TestPackageManager) GetMetadata(ctx context.Context, name string) (pkgmgmt.PackageMetadata, error)
func (*TestPackageManager) GetPackageDir ¶
func (p *TestPackageManager) GetPackageDir(name string) (string, error)
func (*TestPackageManager) Install ¶
func (p *TestPackageManager) Install(ctx context.Context, opts pkgmgmt.InstallOptions) error
func (*TestPackageManager) List ¶
func (p *TestPackageManager) List() ([]string, error)
func (*TestPackageManager) Run ¶
func (p *TestPackageManager) Run(ctx context.Context, pkgContext *portercontext.Context, name string, commandOpts pkgmgmt.CommandOptions) error
func (*TestPackageManager) Uninstall ¶
func (p *TestPackageManager) Uninstall(ctx context.Context, opts pkgmgmt.UninstallOptions) error
type TestRunner ¶
type TestRunner struct { *Runner TestContext *portercontext.TestContext }
func NewTestRunner ¶
NewTestRunner initializes a test runner, with the output buffered, and an in-memory file system.
Click to show internal directories.
Click to hide internal directories.