Documentation ¶
Index ¶
- Constants
- Variables
- type Arg
- type AvailableHookCtx
- type AvailableHookResult
- type AvailableHookResultItem
- type Checksum
- type EnvKeysHookCtx
- type EnvKeysHookResultItem
- type HookFunc
- type Info
- type Location
- type LocationPackage
- type LuaCheckSum
- type LuaPlugin
- func (l *LuaPlugin) Available(args []string) ([]*Package, error)
- func (l *LuaPlugin) CallFunction(funcName string, args ...lua.LValue) error
- func (l *LuaPlugin) Close()
- func (l *LuaPlugin) EnvKeys(sdkPackage *Package) (*env.Envs, error)
- func (l *LuaPlugin) HasFunction(name string) bool
- func (l *LuaPlugin) Label(version string) string
- func (l *LuaPlugin) ParseLegacyFile(path string, installedVersions func() []Version) (Version, error)
- func (l *LuaPlugin) PostInstall(rootPath string, sdks []*Info) error
- func (l *LuaPlugin) PreInstall(version Version) (*Package, error)
- func (l *LuaPlugin) PreUninstall(p *Package) error
- func (l *LuaPlugin) PreUse(version Version, previousVersion Version, scope UseScope, cwd string, ...) (Version, error)
- func (l *LuaPlugin) ShowNotes()
- func (l *LuaPlugin) Validate() error
- type LuaPluginInfo
- type LuaRuntime
- type Manager
- func (m *Manager) Add(pluginName, url, alias string) error
- func (m *Manager) Available() (RegistryIndex, error)
- func (m *Manager) CleanTmp()
- func (m *Manager) Close()
- func (m *Manager) EnvKeys(tvs toolset.MultiToolVersions, location Location) (SdkEnvs, error)
- func (m *Manager) GetRegistryAddress(uri string) string
- func (m *Manager) HttpClient() *http.Client
- func (m *Manager) LoadAllSdk() ([]*Sdk, error)
- func (m *Manager) LookupSdk(name string) (*Sdk, error)
- func (m *Manager) LookupSdkWithInstall(name string) (*Sdk, error)
- func (m *Manager) ParseLegacyFile(output func(sdkname, version string)) error
- func (m *Manager) Remove(pluginName string) error
- func (m *Manager) Update(pluginName string) error
- type NotFoundError
- type Package
- type ParseLegacyFileHookCtx
- type ParseLegacyFileResult
- type PathMeta
- type PostInstallHookCtx
- type PreInstallHookCtx
- type PreInstallHookResult
- type PreInstallHookResultAdditionItem
- type PreUninstallHookCtx
- type PreUseHookCtx
- type PreUseHookResult
- type RegistryIndex
- type RegistryIndexItem
- type RegistryPluginManifest
- type Sdk
- func (b *Sdk) Available(args []string) ([]*Package, error)
- func (b *Sdk) CheckExists(version Version) bool
- func (b *Sdk) ClearCurrentEnv() error
- func (b *Sdk) Close()
- func (b *Sdk) Current() Version
- func (b *Sdk) Download(u *url.URL, headers map[string]string) (string, error)
- func (b *Sdk) EnvKeys(version Version, location Location) (*env.Envs, error)
- func (b *Sdk) GetLinkPackage(version Version, location Location) (*LocationPackage, error)
- func (b *Sdk) GetLocalSdkPackage(version Version) (*Package, error)
- func (b *Sdk) Install(version Version) error
- func (b *Sdk) List() []Version
- func (b *Sdk) MockEnvKeys(version Version, location Location) (*env.Envs, error)
- func (b *Sdk) ParseLegacyFile(path string) (Version, error)
- func (b *Sdk) PreUse(version Version, scope UseScope) (Version, error)
- func (b *Sdk) ToLinkPackage(version Version, location Location) error
- func (b *Sdk) Uninstall(version Version) (err error)
- func (b *Sdk) Use(version Version, scope UseScope) error
- func (b *Sdk) VersionPath(version Version) string
- type SdkEnv
- type SdkEnvs
- type UseScope
- type Version
Constants ¶
const (
HookCurTmpPath = "__VFOX_CURTMPPATH"
)
const RuntimeVersion = "0.5.4"
Variables ¶
var ErrNoVersionProvided = errors.New("no version number provided")
var ( // HookFuncMap is a map of built-in hook functions. HookFuncMap = map[string]HookFunc{ "Available": {Name: "Available", Required: true, Filename: "available"}, "PreInstall": {Name: "PreInstall", Required: true, Filename: "pre_install"}, "EnvKeys": {Name: "EnvKeys", Required: true, Filename: "env_keys"}, "PostInstall": {Name: "PostInstall", Required: false, Filename: "post_install"}, "PreUse": {Name: "PreUse", Required: false, Filename: "pre_use"}, "ParseLegacyFile": {Name: "ParseLegacyFile", Required: false, Filename: "parse_legacy_file"}, "PreUninstall": {Name: "PreUninstall", Required: false, Filename: "pre_uninstall"}, } )
var (
ManifestNotFound = errors.New("manifest not found")
)
var NoneChecksum = &Checksum{
Value: "",
Type: "none",
}
Functions ¶
This section is empty.
Types ¶
type AvailableHookCtx ¶ added in v0.2.5
type AvailableHookCtx struct {
Args []string `luai:"args"`
}
type AvailableHookResult ¶ added in v0.2.5
type AvailableHookResult = []*AvailableHookResultItem
type AvailableHookResultItem ¶ added in v0.2.5
type EnvKeysHookCtx ¶ added in v0.2.5
type EnvKeysHookResultItem ¶ added in v0.2.5
type Info ¶
type LocationPackage ¶ added in v0.5.3
type LocationPackage struct {
// contains filtered or unexported fields
}
LocationPackage represents a package that needs to be linked
func (*LocationPackage) ConvertLocation ¶ added in v0.5.3
func (l *LocationPackage) ConvertLocation() *Package
func (*LocationPackage) Link ¶ added in v0.5.3
func (l *LocationPackage) Link() (*Package, error)
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 Path string // plugin filename, this is also alias name, sdk-name SdkName string *LuaPluginInfo // contains filtered or unexported fields }
func NewLuaPlugin ¶
NewLuaPlugin creates a new LuaPlugin instance from the specified directory path. The plugin directory must meet one of the following conditions: - The directory must contain a metadata.lua file and a hooks directory that includes all must be implemented hook functions. - The directory contain a main.lua file that defines the plugin object and all hook functions.
func (*LuaPlugin) CallFunction ¶ added in v0.2.5
func (*LuaPlugin) HasFunction ¶ added in v0.2.5
func (*LuaPlugin) ParseLegacyFile ¶ added in v0.4.0
func (*LuaPlugin) PostInstall ¶
func (*LuaPlugin) PreUninstall ¶ added in v0.4.0
PreUninstall executes the PreUninstall hook function.
type LuaPluginInfo ¶ added in v0.2.5
type LuaPluginInfo struct { Name string `luai:"name"` Version string `luai:"version"` Description string `luai:"description"` UpdateUrl string `luai:"updateUrl"` ManifestUrl string `luai:"manifestUrl"` Homepage string `luai:"homepage"` License string `luai:"license"` MinRuntimeVersion string `luai:"minRuntimeVersion"` Notes []string `luai:"notes"` LegacyFilenames []string `luai:"legacyFilenames"` }
type LuaRuntime ¶ added in v0.3.0
type LuaRuntime struct { OsType string `luai:"osType"` ArchType string `luai:"archType"` Version string `luai:"version"` PluginDirPath string `luai:"pluginDirPath"` }
LuaRuntime represents the runtime information of the Lua environment.
type Manager ¶
type Manager struct { PathMeta *PathMeta EnvManager env.Manager Config *config.Config // contains filtered or unexported fields }
func NewSdkManager ¶
func NewSdkManager() *Manager
func (*Manager) Add ¶
Add a plugin to plugin home directory 1. If the plugin is an official plugin, fetch the plugin manifest from the registry. 2. If the plugin is a custom plugin, install the plugin from the specified URL. 3. Validate the plugin and install it to the plugin home directory. examples:
vfox add nodejs vfox add --alias node nodejs vfox add --source /path/to/plugin.zip vfox add --source /path/to/plugin.zip --alias node [nodejs]
func (*Manager) Available ¶
func (m *Manager) Available() (RegistryIndex, error)
func (*Manager) GetRegistryAddress ¶ added in v0.3.0
func (*Manager) HttpClient ¶ added in v0.3.2
func (*Manager) LoadAllSdk ¶
func (*Manager) LookupSdkWithInstall ¶ added in v0.3.2
func (*Manager) ParseLegacyFile ¶ added in v0.4.0
ParseLegacyFile parse legacy file and output the sdkname and version
type NotFoundError ¶ added in v0.3.2
type NotFoundError struct {
Msg string
}
func (NotFoundError) Error ¶ added in v0.3.2
func (n NotFoundError) Error() string
type ParseLegacyFileHookCtx ¶ added in v0.4.0
type ParseLegacyFileHookCtx struct { Filepath string `luai:"filepath"` Filename string `luai:"filename"` GetInstalledVersions lua.LGFunction `luai:"getInstalledVersions"` }
type ParseLegacyFileResult ¶ added in v0.4.0
type ParseLegacyFileResult struct {
Version string `luai:"version"`
}
type PostInstallHookCtx ¶ added in v0.2.5
type PreInstallHookCtx ¶ added in v0.2.5
type PreInstallHookCtx struct {
Version string `luai:"version"`
}
type PreInstallHookResult ¶ added in v0.2.5
type PreInstallHookResult struct { Version string `luai:"version"` Url string `luai:"url"` Headers map[string]string `luai:"headers"` Note string `luai:"note"` 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"` Headers map[string]string `luai:"headers"` Note string `luai:"note"` Sha256 string `luai:"sha256"` Sha512 string `luai:"sha512"` Sha1 string `luai:"sha1"` Md5 string `luai:"md5"` }
func (*PreInstallHookResultAdditionItem) Info ¶ added in v0.2.5
func (i *PreInstallHookResultAdditionItem) Info() *Info
type PreUninstallHookCtx ¶ added in v0.4.0
type PreUseHookCtx ¶ added in v0.2.5
type PreUseHookResult ¶ added in v0.2.5
type PreUseHookResult struct {
Version string `luai:"version"`
}
type RegistryIndex ¶ added in v0.3.0
type RegistryIndex []*RegistryIndexItem
RegistryIndex is the index of the registry
type RegistryIndexItem ¶ added in v0.3.0
type RegistryIndexItem struct { Name string `json:"name"` Desc string `json:"desc"` Homepage string `json:"homepage"` }
RegistryIndexItem is the item in the registry index
type RegistryPluginManifest ¶ added in v0.3.0
type RegistryPluginManifest struct { Name string `json:"name"` Version string `json:"version"` License string `json:"license"` Author string `json:"author"` DownloadUrl string `json:"downloadUrl"` MinRuntimeVersion string `json:"minRuntimeVersion"` }
RegistryPluginManifest is the manifest of a remote plugin
type Sdk ¶
type Sdk struct { Plugin *LuaPlugin // current sdk install path InstallPath string // contains filtered or unexported fields }
func (*Sdk) CheckExists ¶ added in v0.4.0
func (*Sdk) ClearCurrentEnv ¶ added in v0.5.0
func (*Sdk) Current ¶
Current returns the current version of the SDK. Lookup priority is: project > session > global
func (*Sdk) GetLinkPackage ¶ added in v0.5.3
func (b *Sdk) GetLinkPackage(version Version, location Location) (*LocationPackage, error)
GetLinkPackage will make symlink according Location and return the sdk package.
func (*Sdk) GetLocalSdkPackage ¶ added in v0.4.0
func (*Sdk) MockEnvKeys ¶ added in v0.5.3
MockEnvKeys It just simulates to get the environment configuration information, if the corresponding location of the package does not exist, then it will return the empty environment information, without calling the EnvKeys hook.