Documentation ¶
Overview ¶
Package pkgmgmt implements the backing package management used by mixins and plugins.
Index ¶
- Constants
- func GetDefaultPackageMirrorURL() url.URL
- func GetPackageListURL(mirror url.URL, pkgType string) string
- type CommandOptions
- type InstallOptions
- type Metadata
- type PackageDownloadOptions
- type PackageList
- type PackageListing
- type PackageManager
- type PackageMetadata
- type PreRunHandler
- type Searcher
- type UninstallOptions
- type VersionInfo
Constants ¶
const DefaultPackageMirror = "https://cdn.porter.sh"
DefaultPackageMirror is the default location from which to download Porter assets, such as binaries, atom feeds and package indexes.
const FileExt = ""
Variables ¶
This section is empty.
Functions ¶
func GetDefaultPackageMirrorURL ¶ added in v0.37.3
GetDefaultPackageMirrorURL returns DefaultPackageMirror parsed as a url.URL
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 { PackageDownloadOptions Name string URL string FeedURL string Version string PackageType 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) GetVersionInfo ¶
func (m Metadata) GetVersionInfo() VersionInfo
GetVersionInfo for the installed package.
type PackageDownloadOptions ¶ added in v0.37.3
type PackageDownloadOptions struct { Mirror string // contains filtered or unexported fields }
PackageDownloadOptions are options for downloading Porter packages, such as mixins and plugins.
func (*PackageDownloadOptions) GetMirror ¶ added in v0.37.3
func (o *PackageDownloadOptions) GetMirror() url.URL
GetMirror returns a copy of of the parsed Mirror that is safe to modify.
func (*PackageDownloadOptions) Validate ¶ added in v0.37.3
func (o *PackageDownloadOptions) Validate() error
type PackageList ¶
type PackageList []PackageListing
PackageList is a collection of PackageListings
func GetPackageListings ¶
func GetPackageListings(url string) (PackageList, error)
GetPackageListings returns the listings for packages via the provided URL
func (PackageList) Len ¶
func (rml PackageList) Len() int
PackageList implements the sort.Interface for []PackageListing based on the Name field.
func (PackageList) Less ¶
func (rml PackageList) Less(i, j int) bool
func (PackageList) Swap ¶
func (rml PackageList) Swap(i, j int)
type PackageListing ¶
type PackageListing struct { Name string `json:"name"` Author string `json:"author"` Description string `json:"description"` URL string `json:"URL"` }
PackageListing represents discovery information for a 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 *portercontext.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 Searcher ¶
type Searcher struct {
List PackageList
}
Searcher can locate a mixin or plugin from the community feeds.
func NewSearcher ¶
func NewSearcher(list PackageList) Searcher
NewSearcher creates a new Searcher from a package distribution list.
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.
Source Files ¶
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). |