Skip to content

Commit f4698fc

Browse files
committed
refactor(plugin): rename LuaPlugin to Plugin and extract functionality
Renamed `LuaPlugin` to `Plugin` and moved its implementation to a separate file (`lua_plugin.go`). This change improves code organization and maintainability by separating concerns and reducing the size of the `plugin.go` file. The `FromLuaPlugin` function was added to convert a `LuaPlugin` instance to a `Plugin` instance, ensuring backward compatibility and cleaner code structure.
1 parent abd52a0 commit f4698fc

4 files changed

Lines changed: 615 additions & 595 deletions

File tree

internal/interfaces.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ import (
2222
lua "github.com/yuin/gopher-lua"
2323
)
2424

25-
type LuaCheckSum struct {
25+
type CheckSum struct {
2626
Sha256 string `json:"sha256"`
2727
Sha512 string `json:"sha512"`
2828
Sha1 string `json:"sha1"`
2929
Md5 string `json:"md5"`
3030
}
3131

32-
func (c *LuaCheckSum) Checksum() *Checksum {
32+
func (c *CheckSum) Checksum() *Checksum {
3333
checksum := &Checksum{}
3434

3535
if c.Sha256 != "" {
@@ -80,7 +80,7 @@ type PreInstallHookResultAdditionItem struct {
8080
}
8181

8282
func (i *PreInstallHookResultAdditionItem) Info() *Info {
83-
sum := LuaCheckSum{
83+
sum := CheckSum{
8484
Sha256: i.Sha256,
8585
Sha512: i.Sha512,
8686
Sha1: i.Sha1,
@@ -116,7 +116,7 @@ func (i *PreInstallHookResult) Info() (*Info, error) {
116116
return nil, ErrNoVersionProvided
117117
}
118118

119-
sum := LuaCheckSum{
119+
sum := CheckSum{
120120
Sha256: i.Sha256,
121121
Sha512: i.Sha512,
122122
Sha1: i.Sha1,
@@ -177,7 +177,7 @@ type PreUninstallHookCtx struct {
177177
SdkInfo map[string]*Info `json:"sdkInfo"`
178178
}
179179

180-
type LuaPluginInfo struct {
180+
type PluginInfo struct {
181181
Name string `json:"name"`
182182
Version string `json:"version"`
183183
Description string `json:"description"`
@@ -190,8 +190,8 @@ type LuaPluginInfo struct {
190190
LegacyFilenames []string `json:"legacyFilenames"`
191191
}
192192

193-
// LuaRuntime represents the runtime information of the Lua environment.
194-
type LuaRuntime struct {
193+
// RuntimeInfo represents the runtime information of the current exec environment.
194+
type RuntimeInfo struct {
195195
OsType string `json:"osType"`
196196
ArchType string `json:"archType"`
197197
Version string `json:"version"`

0 commit comments

Comments
 (0)