workdir

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeGo       = "go"
	SpecFilename    = ".toolset.json"
	LockFilename    = ".toolset.lock.json"
	DefaultToolsDir = "./bin/tools"
)

Variables

This section is empty.

Functions

func InitContext

func InitContext(dir string) (string, error)

InitContext will initialize context in specified

Types

type Context

type Context struct {
	Workdir string
	Spec    *Spec
	Lock    *Lock
}

func NewContext

func NewContext() (*Context, error)

func (*Context) AddGo

func (c *Context) AddGo(ctx context.Context, goBinary string, alias optional.Val[string]) (bool, string, error)

func (*Context) AddInclude added in v0.12.0

func (c *Context) AddInclude(ctx context.Context, source string) (int, error)

func (*Context) CopySource added in v0.12.0

func (c *Context) CopySource(ctx context.Context, source string) (int, error)

CopySource will add all tools from source. Source can be a path to file or a http url.

func (*Context) FindTool

func (c *Context) FindTool(str string) (*Tool, error)

func (*Context) GetToolsDir

func (c *Context) GetToolsDir() string

func (*Context) LockFilename added in v0.12.0

func (c *Context) LockFilename() string

func (*Context) RunTool

func (c *Context) RunTool(ctx context.Context, str string, args ...string) error

func (*Context) Save

func (c *Context) Save() error

func (*Context) SpecFilename

func (c *Context) SpecFilename() string

func (*Context) Sync

func (c *Context) Sync(ctx context.Context, maxWorkers int) error

func (*Context) Upgrade

func (c *Context) Upgrade(ctx context.Context) error

Upgrade will upgrade only spec tools. and re-fetch latest versions of includes.

type GoModule

type GoModule struct {
	Version string    `json:"Version"`
	Time    time.Time `json:"Time"`
	Origin  struct {
		VCS  string `json:"VCS"`
		URL  string `json:"URL"`
		Hash string `json:"Hash"`
		Ref  string `json:"Ref"`
	} `json:"Origin"`
}

type Include added in v0.12.0

type Include string

func (Include) IsSame added in v0.12.0

func (i Include) IsSame(include Include) bool

type Lock added in v0.12.0

type Lock struct {
	Tools   Tools        `json:"tools"`
	Remotes []RemoteSpec `json:"remotes"`
}

type RemoteSpec added in v0.12.0

type RemoteSpec struct {
	Source string
	Spec   Spec
}

type Spec

type Spec struct {
	Dir      string    `json:"dir"`
	Tools    Tools     `json:"tools"`
	Includes []Include `json:"includes"`
}

func (*Spec) AddInclude added in v0.12.0

func (s *Spec) AddInclude(include Include) bool

type Tool

type Tool struct {
	// Name of runtime
	Runtime string `json:"runtime"`
	// Path to module with version
	Module string `json:"module"`
	// Alias create a link in tools. Works like exposing some tools
	Alias optional.Val[string] `json:"alias"`
}

func (Tool) IsSame

func (t Tool) IsSame(tool Tool) bool

type Tools added in v0.12.0

type Tools []Tool

func (*Tools) Add added in v0.12.0

func (tools *Tools) Add(tool Tool) bool

func (*Tools) AddOrUpdateTool added in v0.12.0

func (tools *Tools) AddOrUpdateTool(tool Tool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL