Documentation
¶
Index ¶
- func GetAvailableVersions(ctx *context.Context, toothRepoPath string) (semver.Versions, error)
- func GetLatestVersion(ctx *context.Context, toothRepoPath string) (semver.Version, error)
- func GetLatestVersionInVersionRange(ctx *context.Context, toothRepoPath string, versionRange semver.Range) (semver.Version, error)
- func IsInstalled(ctx *context.Context, toothRepoPath string) (bool, error)
- func IsValidToothRepoPath(toothRepoPath string) bool
- type Archive
- type Commands
- type Files
- type FilesPlaceItem
- type Info
- type Metadata
- func (m Metadata) AssetURL() (*url.URL, error)
- func (m Metadata) Commands() Commands
- func (m Metadata) Dependencies() (map[string]semver.Range, error)
- func (m Metadata) DependenciesAsStrings() map[string]string
- func (m Metadata) Files() (Files, error)
- func (m Metadata) Info() Info
- func (m Metadata) IsWildcardPopulated() bool
- func (m Metadata) MarshalJSON() ([]byte, error)
- func (m Metadata) Prerequisites() (map[string]semver.Range, error)
- func (m Metadata) PrerequisitesAsStrings() map[string]string
- func (m Metadata) ToFilePathPrefixPrepended(prefix path.Path) Metadata
- func (m Metadata) ToPlatformSpecific(goos string, goarch string) (Metadata, error)
- func (m Metadata) ToWildcardPopulated(filePaths []path.Path) (Metadata, error)
- func (m Metadata) ToothRepoPath() string
- func (m Metadata) Version() semver.Version
- type RawMetadata
- type RawMetadataCommands
- type RawMetadataFiles
- type RawMetadataFilesPlaceItem
- type RawMetadataInfo
- type RawMetadataPlatformsItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAvailableVersions ¶
GetAvailableVersions fetches the version list of a tooth repository.
func GetLatestVersion ¶
GetLatestVersion returns the latest =version of a tooth repository.
func GetLatestVersionInVersionRange ¶
func GetLatestVersionInVersionRange(ctx *context.Context, toothRepoPath string, versionRange semver.Range) (semver.Version, error)
GetLatestVersionInVersionRange returns the latest version in a version range.
func IsInstalled ¶
IsInstalled checks if a tooth is installed.
func IsValidToothRepoPath ¶
IsValidToothRepoPath checks if the tooth repository path is valid.
Types ¶
type Archive ¶
type Archive struct {
// contains filtered or unexported fields
}
Archive is an archive containing a tooth.
func MakeArchive ¶
MakeArchive creates a new archive. It will automatically convert metadata to platform-specific.
func (Archive) AssetFilePath ¶ added in v0.19.0
func (Archive) ToAssetArchiveAttached ¶ added in v0.19.0
ToAssetArchiveAttached converts the archive to an archive with asset archive attached. If assetArchivePath is empty, the tooth archive will be used as the asset archive.
type Files ¶ added in v0.19.0
type Files struct {
Place []FilesPlaceItem
Preserve []path.Path
Remove []path.Path
}
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func GetAllMetadata ¶
GetAllMetadata lists all installed tooth metadata.
func GetMetadata ¶
GetMetadata finds the installed tooth metadata.
func MakeMetadata ¶
MakeMetadata parses the given jsonBytes and returns a Metadata.
func MakeMetadataFromRaw ¶
func MakeMetadataFromRaw(rawMetadata RawMetadata) (Metadata, error)
MakeMetadataFromRaw returns a Metadata from the given RawMetadata.
func (Metadata) DependenciesAsStrings ¶
func (Metadata) IsWildcardPopulated ¶ added in v0.19.0
func (Metadata) MarshalJSON ¶
func (Metadata) PrerequisitesAsStrings ¶
func (Metadata) ToFilePathPrefixPrepended ¶ added in v0.19.0
ToFilePathPrefixPrepended prepends the given prefix to files.place field of metadata.
func (Metadata) ToPlatformSpecific ¶ added in v0.18.1
func (Metadata) ToWildcardPopulated ¶ added in v0.19.0
ToWildcardPopulated populates wildcards in files.place field of metadata.
func (Metadata) ToothRepoPath ¶
type RawMetadata ¶
type RawMetadata struct {
FormatVersion int `json:"format_version"`
Tooth string `json:"tooth"`
Version string `json:"version"`
Info RawMetadataInfo `json:"info"`
AssetURL string `json:"asset_url,omitempty"`
Commands RawMetadataCommands `json:"commands,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
Prerequisites map[string]string `json:"prerequisites,omitempty"`
Files RawMetadataFiles `json:"files,omitempty"`
Platforms []RawMetadataPlatformsItem `json:"platforms,omitempty"`
}
Why to split Metadata and RawMetadata? Because we encounter a problem when we want to add a getter with the same name as a field.
type RawMetadataCommands ¶
type RawMetadataFiles ¶
type RawMetadataFiles struct {
Place []RawMetadataFilesPlaceItem `json:"place,omitempty"`
Preserve []string `json:"preserve,omitempty"`
Remove []string `json:"remove,omitempty"`
}
type RawMetadataInfo ¶
type RawMetadataPlatformsItem ¶
type RawMetadataPlatformsItem struct {
GOARCH string `json:"goarch,omitempty"`
GOOS string `json:"goos"`
AssetURL string `json:"asset_url,omitempty"`
Commands RawMetadataCommands `json:"commands,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
Prerequisites map[string]string `json:"prerequisites,omitempty"`
Files RawMetadataFiles `json:"files,omitempty"`
}