internal

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LuaPluginObjKey = "PLUGIN"
	OsType          = "OS_TYPE"
	ArchType        = "ARCH_TYPE"
)
View Source
const RuntimeVersion = "0.2.5"

Variables

View Source
var NoneChecksum = &Checksum{
	Value: "",
	Type:  "none",
}

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name    string
	Version string
}

type AvailableHookCtx added in v0.2.5

type AvailableHookCtx struct {
	RuntimeVersion string `luai:"runtimeVersion"`
}

type AvailableHookResult added in v0.2.5

type AvailableHookResult = []*AvailableHookResultItem

type AvailableHookResultItem added in v0.2.5

type AvailableHookResultItem struct {
	Version string `luai:"version"`
	Note    string `luai:"note"`

	Addition []*Info `luai:"addition"`
}

type Category

type Category struct {
	Name    string              `json:"category"`
	Count   string              `json:"count"`
	Plugins []*RemotePluginInfo `json:"files"`
}

type Checksum

type Checksum struct {
	Value string
	Type  string
}

type EnvKeysHookCtx added in v0.2.5

type EnvKeysHookCtx struct {
	RuntimeVersion string `luai:"runtimeVersion"`
	Main           *Info  `luai:"main"`
	// TODO Will be deprecated in future versions
	Path    string           `luai:"path"`
	SdkInfo map[string]*Info `luai:"sdkInfo"`
}

type EnvKeysHookResultItem added in v0.2.5

type EnvKeysHookResultItem struct {
	Key   string `luai:"key"`
	Value string `luai:"value"`
}

type Info

type Info struct {
	Name     string  `luai:"name"`
	Version  Version `luai:"version"`
	Path     string  `luai:"path"`
	Note     string  `luai:"note"`
	Checksum *Checksum
}

type LuaCheckSum added in v0.2.5

type LuaCheckSum struct {
	Sha256 string `luai:"sha256"`
	Sha512 string `luai:"sha512"`
	Sha1   string `luai:"sha1"`
	Md5    string `luai:"md5"`
}

func (*LuaCheckSum) Checksum added in v0.2.5

func (c *LuaCheckSum) Checksum() *Checksum

type LuaPlugin

type LuaPlugin struct {

	// plugin source path
	Filepath string
	// plugin filename, this is also alias name, sdk-name
	SdkName string

	LuaPluginInfo
	// contains filtered or unexported fields
}

func NewLuaPlugin

func NewLuaPlugin(content, path string, manager *Manager) (*LuaPlugin, error)

func (*LuaPlugin) Available

func (l *LuaPlugin) Available() ([]*Package, error)

func (*LuaPlugin) CallFunction added in v0.2.5

func (l *LuaPlugin) CallFunction(funcName string, args ...lua.LValue) error

func (*LuaPlugin) Close

func (l *LuaPlugin) Close()

func (*LuaPlugin) EnvKeys

func (l *LuaPlugin) EnvKeys(sdkPackage *Package) (*env.Envs, error)

func (*LuaPlugin) HasFunction added in v0.2.5

func (l *LuaPlugin) HasFunction(name string) bool

func (*LuaPlugin) Label

func (l *LuaPlugin) Label(version string) string

func (*LuaPlugin) PostInstall

func (l *LuaPlugin) PostInstall(rootPath string, sdks []*Info) error

func (*LuaPlugin) PreInstall

func (l *LuaPlugin) PreInstall(version Version) (*Package, error)

func (*LuaPlugin) PreUse added in v0.2.5

func (l *LuaPlugin) PreUse(version Version, previousVersion Version, scope UseScope, cwd string, installedSdks []*Package) (Version, error)

type LuaPluginInfo added in v0.2.5

type LuaPluginInfo struct {
	Name              string `luai:"name"`
	Author            string `luai:"author"`
	Version           string `luai:"version"`
	Description       string `luai:"description"`
	UpdateUrl         string `luai:"updateUrl"`
	MinRuntimeVersion string `luai:"minRuntimeVersion"`
}

type Manager

type Manager struct {
	PathMeta *PathMeta

	EnvManager env.Manager
	Record     env.Record

	Config *config.Config
	// contains filtered or unexported fields
}

func NewSdkManager

func NewSdkManager(sources ...RecordSource) *Manager

func NewSdkManagerWithSource

func NewSdkManagerWithSource(sources ...RecordSource) *Manager

func (*Manager) Add

func (m *Manager) Add(pluginName, url, alias string) error

func (*Manager) Available

func (m *Manager) Available() ([]*Category, error)

func (*Manager) CleanTmp added in v0.2.3

func (m *Manager) CleanTmp()

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) EnvKeys

func (m *Manager) EnvKeys() (*env.Envs, error)

func (*Manager) LoadAllSdk

func (m *Manager) LoadAllSdk() (map[string]*Sdk, error)

func (*Manager) LookupSdk

func (m *Manager) LookupSdk(name string) (*Sdk, error)

LookupSdk lookup sdk by name

func (*Manager) Remove

func (m *Manager) Remove(pluginName string) error

func (*Manager) Update

func (m *Manager) Update(pluginName string) error

type Package

type Package struct {
	Main      *Info
	Additions []*Info
}

type PathMeta

type PathMeta struct {
	TempPath string
	// Temporary directory for the current process
	CurTmpPath       string
	ConfigPath       string
	SdkCachePath     string
	PluginPath       string
	ExecutablePath   string
	WorkingDirectory string
}

type PostInstallHookCtx added in v0.2.5

type PostInstallHookCtx struct {
	RuntimeVersion string           `luai:"runtimeVersion"`
	RootPath       string           `luai:"rootPath"`
	SdkInfo        map[string]*Info `luai:"sdkInfo"`
}

type PreInstallHookCtx added in v0.2.5

type PreInstallHookCtx struct {
	Version        string `luai:"version"`
	RuntimeVersion string `luai:"runtimeVersion"`
}

type PreInstallHookResult added in v0.2.5

type PreInstallHookResult struct {
	Version string `luai:"version"`
	Url     string `luai:"url"`

	Sha256 string `luai:"sha256"`
	Sha512 string `luai:"sha512"`
	Sha1   string `luai:"sha1"`
	Md5    string `luai:"md5"`

	Addition []*PreInstallHookResultAdditionItem `luai:"addition"`
}

func (*PreInstallHookResult) Info added in v0.2.5

func (i *PreInstallHookResult) Info() (*Info, error)

type PreInstallHookResultAdditionItem added in v0.2.5

type PreInstallHookResultAdditionItem struct {
	Name string `luai:"name"`
	Url  string `luai:"url"`

	Sha256 string `luai:"sha256"`
	Sha512 string `luai:"sha512"`
	Sha1   string `luai:"sha1"`
	Md5    string `luai:"md5"`
}

func (*PreInstallHookResultAdditionItem) Info added in v0.2.5

type PreUseHookCtx added in v0.2.5

type PreUseHookCtx struct {
	RuntimeVersion  string           `luai:"runtimeVersion"`
	Cwd             string           `luai:"cwd"`
	Scope           string           `luai:"scope"`
	Version         string           `luai:"version"`
	PreviousVersion string           `luai:"previousVersion"`
	InstalledSdks   map[string]*Info `luai:"installedSdks"`
}

type PreUseHookResult added in v0.2.5

type PreUseHookResult struct {
	Version string `luai:"version"`
}

type RecordSource

type RecordSource string
const (
	GlobalRecordSource  RecordSource = "global"
	ProjectRecordSource RecordSource = "project"
	SessionRecordSource RecordSource = "session"
)

type RemotePluginInfo

type RemotePluginInfo struct {
	Filename string `json:"name"`
	Author   string `json:"plugin_author"`
	Desc     string `json:"plugin_desc"`
	Name     string `json:"plugin_name"`
	Version  string `json:"plugin_version"`
	Sha256   string `json:"sha256"`
	Url      string `json:"url"`
}

type Sdk

type Sdk struct {
	Plugin *LuaPlugin
	// current sdk install path
	InstallPath string
	// contains filtered or unexported fields
}

func NewSdk

func NewSdk(manager *Manager, source *LuaPlugin) (*Sdk, error)

func (*Sdk) Available

func (b *Sdk) Available() ([]*Package, error)

func (*Sdk) Close

func (b *Sdk) Close()

func (*Sdk) Current

func (b *Sdk) Current() Version

func (*Sdk) Download

func (b *Sdk) Download(u *url.URL) (string, error)

func (*Sdk) EnvKeys

func (b *Sdk) EnvKeys(version Version) (*env.Envs, error)

func (*Sdk) Install

func (b *Sdk) Install(version Version) error

func (*Sdk) List

func (b *Sdk) List() []Version

func (*Sdk) PreUse added in v0.2.5

func (b *Sdk) PreUse(version Version, scope UseScope) (Version, error)

func (*Sdk) Uninstall

func (b *Sdk) Uninstall(version Version) error

func (*Sdk) Use

func (b *Sdk) Use(version Version, scope UseScope) error

func (*Sdk) VersionPath

func (b *Sdk) VersionPath(version Version) string

type UseScope

type UseScope int
const (
	Global UseScope = iota
	Project
	Session
)

func (UseScope) String added in v0.2.5

func (s UseScope) String() string

type Version

type Version string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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