Documentation
¶
Index ¶
- func Install(basePath, version string, force, windows bool, max uint, b Binary, ...) (s string, err error)
- func Installed(basePath, binary, version string) (bool, error)
- func LinkedVersion(basePath, binary string) (string, error)
- func ListInstalled(basePath string) ([]string, error)
- func ListToolVersionsInstalled(basePath, binary string) ([]string, error)
- func Purge(basePath, binary string) error
- func RemoveVersions(basePath string, binary string, versions []string) error
- type Binary
- type GithubReleaseTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Installed ¶
Installed checks if a binary version is already downloaded. While walking through the paths, it also checks to make sure that the path is valid. If a binary is found at the end of the path, it returns true
func LinkedVersion ¶
LinkedVersion checks if a binary is symlinked, and returns the version symlinked It returns an error if the binary is not symlinked The symlink we are checking could exist in three states, "existing", "broken", and "not existing" "existing" is a happy symlink. Symlink exists, and the link is not broken "broken" is a sad symlink. Symlink exists, and the link not broken "not existing" is depressed symlink. Symlink does not exist, but it's ok
func ListInstalled ¶
ListInstalled returns the list of installed binaries
func ListToolVersionsInstalled ¶
ListToolVersionsInstalled will list all of the downloaded versions of a binary
Types ¶
type Binary ¶
type Binary interface { // Name returns the name of the binary Name() string // ShortDesc returns a short description of the binary ShortDesc() string // LongDesc returns a long description of the binary LongDesc() string // Given a version, it returns a url to fetch the file MakeUrl(version string) (string, error) // Versions lists the possible installation candidates for a source like Github releases. // It gives a sorted slice, based of stability. For example, all of the stable releases will appear // before a beta release, and all of the beta releases will appear before the alpha releases. The sorting // is implementation specific. Versions(max uint) ([]string, error) // Extract takes the downloaded artifacts and does some processing on it to extract the binary. // This is useful for binaries like helm, where a tar file is downloaded, // containing a LICENSE file, a README file and the helm binary. This method would allow for // extracting just the binary before installing. Note that this is called after the artifacts // have already been downloaded, so this means that the downloaded file will already by // unzipped and/or un-tarred. Extract(artifactPath, version string) (string, error) }
Binary is an interface that all binaries must implement
type GithubReleaseTool ¶
type GithubReleaseTool struct {
Owner, Repo string
}
func MakeGithubReleaseTool ¶
func MakeGithubReleaseTool(org, repo string) GithubReleaseTool
func (GithubReleaseTool) Extract ¶
func (l GithubReleaseTool) Extract(artifactPath, _ string) (string, error)
func (GithubReleaseTool) MakeReleaseUrl ¶
func (l GithubReleaseTool) MakeReleaseUrl() string