Documentation
¶
Overview ¶
Package client provides the high level API for using shed.
Index ¶
Constants ¶
const LockfileName = "shed.lock"
Variables ¶
This section is empty.
Functions ¶
func ResolveLockfilePath ¶
ResolveLockfilePath resolves the path to the nearest shed lockfile starting at dir. It will keep searching parent directories until either a lockfile is found, or the root directory is reached. If no lockfile is found, an empty string will be returned.
Types ¶
type GetOptions ¶
type GetOptions struct { // ToolNames is a list of tools that should be installed. // These will be unioned with the tools specified in the lockfile. ToolNames []string // Update sets whether or not tools should be updated to the latest available // minor or patch version. If ToolNames is not empty, only those tools will be // updated. Otherwise, all tools in the lockfile will be updated. Update bool }
GetOptions is used to configure Shed.Get.
type InstallSet ¶
type InstallSet struct { // Concurrency sets the amount of installs that will run concurrently. // It defaults to the number of CPUs available. Concurrency uint // contains filtered or unexported fields }
InstallSet represents a set of tools that are to be installed. To perform the installation call the Apply method. To abort the install, simply discard the InstallSet object.
func (*InstallSet) Apply ¶
func (is *InstallSet) Apply(ctx context.Context) error
Apply will install each tool in the InstallSet and add them to the lockfile.
The provided context is used to terminate the install if the context becomes done before the install completes on its own.
func (*InstallSet) Len ¶
func (is *InstallSet) Len() int
Len returns the number of tools in the InstallSet.
func (*InstallSet) Notify ¶
func (is *InstallSet) Notify(ch chan<- tool.Tool)
Notify causes the InstallSet to relay completed actions to ch. This is useful to keep track of the progress of installation. You should receive from ch on a separate goroutine than the one that Apply is called on, since Apply will block until all tools are installed.
type ListOptions ¶
type ListOptions struct { // ShowUpdates makes List check if a newer version of each tool is available. ShowUpdates bool // Concurrency sets the amount of update checks that will happen // concurrently when ShowUpdates is true. // It defaults to the number of CPUs available. Concurrency uint }
ListOptions is used to configure Shed.List.
type Option ¶
type Option func(*Shed)
Option is a function that takes a Shed instance and applies a configuration to it.
func WithLockfilePath ¶
WithLockfilePath sets the path to lockfile.
func WithLogger ¶
func WithLogger(logger logrus.FieldLogger) Option
WithLogger sets a logger that should be used for writing debug messages. By default no logging is done.
type Shed ¶
type Shed struct {
// contains filtered or unexported fields
}
Shed provides the API for managing tool dependencies with shed.
func NewShed ¶
NewShed creates a new Shed instance. Options can be provided to customize the created Shed instance.
By default, the lockfile path used is './shed.lock' and the cache directory is 'os.UserCacheDir()/shed'.
func (*Shed) CacheDir ¶
CacheDir returns the OS filesystem directory where the shed cache is located.
func (*Shed) CleanCache ¶
CleanCache removes the cache directory and all contents from the filesystem.
func (*Shed) Get ¶
func (s *Shed) Get(opts GetOptions) (*InstallSet, error)
Get computes a set of tools that should be installed. Zero or more tools can be specified in opts. These will be unioned with the tools in the lockfile to produce a final set of tools to install. Get will return an InstallSet instance which can be used to perform the actual installation.
Get does not modify any state, therefore, if you wish to abort the install simply discard the returned InstallSet.
All tool names provided must be full import paths, not binary names. If a tool name is invalid, Get will return an error.
If opts.Update is set, tool names must not include version suffixes.
type ToolInfo ¶
type ToolInfo struct { // Tool contains the details of the installed tool. Tool tool.Tool // LatestVersion specifies the latest version of the tool // if ShowUpdates was set to true and a newer version was found. // Otherwise it is an empty string. LatestVersion string }
ToolInfo contains information about a tool returned by Shed.List.