Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed Mar 14, 2024
0 parents commit aa1c425
Show file tree
Hide file tree
Showing 15 changed files with 203 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/vfox-plugin-template.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added .tool-versions
Empty file.
Empty file added LICENSE
Empty file.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# vfox-plugin-template
18 changes: 18 additions & 0 deletions hooks/available.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- Return all available versions provided by this plugin
--- @param ctx table Empty table used as context, for future extension
--- @return table Descriptions of available versions and accompanying tool descriptions
function PLUGIN:Available(ctx)
local runtimeVersion = ctx.runtimeVersion
return {
{
version = "xxxx",
note = "LTS",
addition = {
{
name = "npm",
version = "8.8.8",
}
}
}
}
end
34 changes: 34 additions & 0 deletions hooks/env_keys.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- Each SDK may have different environment variable configurations.
--- This allows plugins to define custom environment variables (including PATH settings)
--- Note: Be sure to distinguish between environment variable settings for different platforms!
--- @param ctx table Context information
--- @field ctx.path string SDK installation directory
function PLUGIN:EnvKeys(ctx)
--- this variable is same as ctx.sdkInfo['plugin-name'].path
local mainPath = ctx.path
local runtimeVersion = ctx.runtimeVersion
local mainSdkInfo = ctx.main
local mpath = mainSdkInfo.path
local mversion = mainSdkInfo.version
local mname = mainSdkInfo.name
local sdkInfo = ctx.sdkInfo['sdk-name']
local path = sdkInfo.path
local version = sdkInfo.version
local name = sdkInfo.name
return {
{
key = "JAVA_HOME",
value = mainPath
},
{
key = "PATH",
value = mainPath .. "/bin"
},
{
key = "PATH",
value = mainPath .. "/bin2"
},

}

end
12 changes: 12 additions & 0 deletions hooks/post_install.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- Extension point, called after PreInstall, can perform additional operations,
--- such as file operations for the SDK installation directory or compile source code
--- Currently can be left unimplemented!
function PLUGIN:PostInstall(ctx)
--- ctx.rootPath SDK installation directory
local rootPath = ctx.rootPath
local runtimeVersion = ctx.runtimeVersion
local sdkInfo = ctx.sdkInfo['sdk-name']
local path = sdkInfo.path
local version = sdkInfo.version
local name = sdkInfo.name
end
12 changes: 12 additions & 0 deletions hooks/post_plugin_add.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


--- TODO: Used to manage locally installed SDKs
function PLUGIN:CheckLocalSDK(ctx)

return {
{
version = "x.x.x",
path = 'path/to/sdk',
}
}
end
4 changes: 4 additions & 0 deletions hooks/prase_legacy_file.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--- TODO: Compatible with legacy files, such as `.nvmrc`, `.node-version`, etc.
function PLUGIN:ParseLegacyFile(ctx)
local filename = ctx.filename
end
40 changes: 40 additions & 0 deletions hooks/pre_install.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- Returns some pre-installed information, such as version number, download address, local files, etc.
--- If checksum is provided, vfox will automatically check it for you.
--- @param ctx table
--- @field ctx.version string User-input version
--- @return table Version information
function PLUGIN:PreInstall(ctx)
local version = ctx.version
local runtimeVersion = ctx.runtimeVersion
return {
--- Version number
version = "xxx",
--- remote URL or local file path [optional]
url = "xxx",
--- SHA256 checksum [optional]
sha256 = "xxx",
--- md5 checksum [optional]
md5 = "xxx",
--- sha1 checksum [optional]
sha1 = "xxx",
--- sha512 checksum [optional]
sha512 = "xx",
--- additional need files [optional]
addition = {
{
--- additional file name !
name = "xxx",
--- remote URL or local file path [optional]
url = "xxx",
--- SHA256 checksum [optional]
sha256 = "xxx",
--- md5 checksum [optional]
md5 = "xxx",
--- sha1 checksum [optional]
sha1 = "xxx",
--- sha512 checksum [optional]
sha512 = "xx",
}
}
}
end
28 changes: 28 additions & 0 deletions hooks/pre_use.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- When user invoke `use` command, this function will be called to get the
--- valid version information.
--- @param ctx table Context information
function PLUGIN:PreUse(ctx)
local runtimeVersion = ctx.runtimeVersion
--- user input version
local version = ctx.version
--- user current used version
local previousVersion = ctx.previousVersion

--- installed sdks
local sdkInfo = ctx.installedSdks['version']
local path = sdkInfo.path
local name = sdkInfo.name
local version = sdkInfo.version

--- working directory
local cwd = ctx.cwd

--- user input scope
--- could be one of global/project/session
local scope = ctx.scope

--- return the version information
return {
version = version,
}
end
23 changes: 23 additions & 0 deletions metadata.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- !!! DO NOT EDIT OR RENAME !!!
PLUGIN = {}

--- !!! MUST BE SET !!!
--- Plugin name
PLUGIN.name = "java"
--- Plugin author
PLUGIN.author = "Lihan"
--- Plugin version
PLUGIN.version = "0.0.1"
-- Update URL
PLUGIN.updateUrl = "{URL}/sdk.lua"

--- !!! OPTIONAL !!!
--- Plugin description
PLUGIN.description = "xxx"
-- minimum compatible vfox version
PLUGIN.minRuntimeVersion = "0.2.2"
-- legacy filenames
PLUGIN.legacyFilenames = {
".nvmrc",
".node-version",
}

0 comments on commit aa1c425

Please sign in to comment.