Documentation ¶
Index ¶
Constants ¶
View Source
const (
ZIP_INFO_FILENAME = "pkg.info"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultStrategy ¶ added in v0.0.2
type DefaultStrategy struct{}
func NewStrategy ¶ added in v0.0.2
func NewStrategy() *DefaultStrategy
func (*DefaultStrategy) GenInstallPath ¶ added in v0.0.2
func (s *DefaultStrategy) GenInstallPath(dir string, pkgInfo PackageInfo) (string, error)
type Installer ¶
type Installer interface { // 读取安装包信息 // Param: path安装包路径,请使用绝对路径 // Return: Package安装包信息, error 读取错误 ReadInfo(path string) (PackageInfo, error) // 安装 // Param: path安装包路径,请使用绝对路径 // Return: Package安装信息, error 安装错误 Install(path string, strategy Strategy) (Package, error) // 卸载 // Param: pkg安装包信息,delPkg是否同时删除安装包 // Return: error 卸载错误 Uninstall(pkg Package, delPkg bool) error }
type JsonRecorder ¶ added in v0.0.3
type JsonRecorder struct {
// contains filtered or unexported fields
}
func CreateJsonRecorder ¶ added in v0.0.3
func CreateJsonRecorder(path string) (*JsonRecorder, error)
func (*JsonRecorder) GetPackage ¶ added in v0.0.3
func (r *JsonRecorder) GetPackage(name string) []Package
func (*JsonRecorder) ListPackage ¶ added in v0.0.3
func (r *JsonRecorder) ListPackage() []Package
func (*JsonRecorder) Remove ¶ added in v0.0.3
func (r *JsonRecorder) Remove(pkg Package) error
func (*JsonRecorder) Save ¶ added in v0.0.3
func (r *JsonRecorder) Save(pkg Package) error
type PackageInfo ¶
type Strategy ¶ added in v0.0.2
type Strategy interface { // 生成安装包安装路径 GenInstallPath(dir string, pkgInfo PackageInfo) (string, error) }
type ZipInstaller ¶
type ZipInstaller struct {
// contains filtered or unexported fields
}
func CreateInstaller ¶
func CreateInstaller(installDir string) (*ZipInstaller, error)
func (*ZipInstaller) Install ¶
func (inst *ZipInstaller) Install(path string, strategy Strategy) (Package, error)
func (*ZipInstaller) ReadInfo ¶
func (inst *ZipInstaller) ReadInfo(path string) (PackageInfo, error)
type ZipPackage ¶
type ZipPackage struct { Name string `json:"name" yaml:"name"` Version int `json:"version" yaml:"version"` Info string `json:"info" yaml:"info"` PkgPath string `json:"pkgPath" yaml:"pkgPath"` InstallPath string `json:"installPath" yaml:"installPath"` }
func (*ZipPackage) Equal ¶ added in v0.0.3
func (pkg *ZipPackage) Equal(other Package) bool
func (*ZipPackage) GetInfo ¶
func (pkg *ZipPackage) GetInfo() string
func (*ZipPackage) GetInstallPath ¶
func (pkg *ZipPackage) GetInstallPath() string
func (*ZipPackage) GetName ¶
func (pkg *ZipPackage) GetName() string
func (*ZipPackage) GetVersion ¶
func (pkg *ZipPackage) GetVersion() int
func (*ZipPackage) Uninstall ¶
func (pkg *ZipPackage) Uninstall(delPkg bool) (err error)
type ZipPackageInfo ¶
type ZipPackageInfo struct { ProtocolVersion int `json:"protocolVersion" yaml:"protocolVersion"` AppVersion int `json:"appVersion" yaml:"appVersion"` Name string `json:"name" yaml:"name"` ExecCmd string `json:"execCmd" yaml:"execCmd"` Info string `json:"info" yaml:"info"` Description string `json:"description" yaml:"description"` ExecName string `json:"execName" yaml:"execName"` Checksum string `json:"checksum" yaml:"checksum"` }
func (*ZipPackageInfo) GetName ¶
func (r *ZipPackageInfo) GetName() string
type ZipRecorder ¶
type ZipRecorder struct {
// contains filtered or unexported fields
}
func CreateRecorder ¶
func CreateRecorder(path string) (*ZipRecorder, error)
func (*ZipRecorder) GetPackage ¶
func (r *ZipRecorder) GetPackage(name string) []Package
func (*ZipRecorder) ListPackage ¶
func (r *ZipRecorder) ListPackage() []Package
func (*ZipRecorder) Remove ¶
func (r *ZipRecorder) Remove(pkg Package) error
func (*ZipRecorder) Save ¶
func (r *ZipRecorder) Save(pkg Package) error
Click to show internal directories.
Click to hide internal directories.