workdir

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 16 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], tags []string) (bool, string, error)

func (*Context) AddInclude added in v0.12.0

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

func (*Context) CopySource added in v0.12.0

func (c *Context) CopySource(ctx context.Context, source string, tags []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, tags []string) error

func (*Context) Upgrade

func (c *Context) Upgrade(ctx context.Context, tags []string) 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 struct {
	Src  string   `json:"src"`
	Tags []string `json:"tags"`
}

TODO(zhuravlev): migrate from string to object

func (Include) IsSame added in v0.12.0

func (i Include) IsSame(include Include) bool

func (*Include) UnmarshalJSON added in v0.14.0

func (i *Include) UnmarshalJSON(bb []byte) error

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   `json:"Source"` // TODO(zhuravlev): make it lowercase, add migration
	Spec   Spec     `json:"Spec"`
	Tags   []string `json:"Tags"`
}

type SourceUri added in v0.13.0

type SourceUri interface {
	// contains filtered or unexported methods
}

type SourceUriFile added in v0.13.0

type SourceUriFile struct {
	Path string
}

type SourceUriGit added in v0.13.0

type SourceUriGit struct {
	Addr string
	Path string
}

type SourceUriUrl added in v0.13.0

type SourceUriUrl struct {
	URL string
}

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"`
	Tags  []string             `json:"tags"`
}

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)

func (*Tools) Filter added in v0.14.0

func (tools *Tools) Filter(tags []string) Tools

Jump to

Keyboard shortcuts

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