-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aa1c425
Showing
15 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# vfox-plugin-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} |