installer

package
v0.0.59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2022 License: MIT Imports: 25 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ConfigGitHub is the default git repository URI
	ConfigGitHub = "https://github.com/LinuxSuRen/hd-home"
	// ConfigBranch is the default branch name of hd-home git repository
	ConfigBranch = "master"
)
View Source
const (
	// ProviderGitHub represents https://github.com
	ProviderGitHub = "github"
)

Variables

This section is empty.

Functions

func FindByKeyword added in v0.0.56

func FindByKeyword(keyword, configDir string) (result []string)

FindByKeyword find org/repo by a keyword

func FindCategories added in v0.0.54

func FindCategories() (result []string)

FindCategories returns the whole supported categories

func IsSupport

func IsSupport(cfg HDConfig) bool

IsSupport checks if support

Types

type CmdWithArgs

type CmdWithArgs struct {
	Cmd  string   `yaml:"cmd"`
	Args []string `yaml:"args"`
}

CmdWithArgs is a command with arguments

type DefaultFetcher added in v0.0.56

type DefaultFetcher struct {
}

DefaultFetcher is the default fetcher which fetches the config files from a git repository

func (*DefaultFetcher) FetchLatestRepo added in v0.0.56

func (f *DefaultFetcher) FetchLatestRepo(provider string, branch string,
	progress io.Writer) (err error)

FetchLatestRepo fetches the hd-home as the config

func (*DefaultFetcher) GetConfigDir added in v0.0.56

func (f *DefaultFetcher) GetConfigDir() (configDir string, err error)

GetConfigDir returns the directory of the config

type FakeFetcher added in v0.0.56

type FakeFetcher struct {
	ConfigDir          string
	GetConfigDirErr    error
	FetchLatestRepoErr error
}

FakeFetcher is a fake fetch. We expect to use it for unit test cases.

func (*FakeFetcher) FetchLatestRepo added in v0.0.56

func (f *FakeFetcher) FetchLatestRepo(provider string, branch string,
	progress io.Writer) (err error)

FetchLatestRepo is fake method

func (*FakeFetcher) GetConfigDir added in v0.0.56

func (f *FakeFetcher) GetConfigDir() (configDir string, err error)

GetConfigDir is a fake method

type Fetcher added in v0.0.56

type Fetcher interface {
	GetConfigDir() (configDir string, err error)
	FetchLatestRepo(provider string, branch string,
		progress io.Writer) (err error)
}

Fetcher is the interface of a fetcher which responses to fetch config files

type HDConfig

type HDConfig struct {
	Name             string            `yaml:"name"`
	Categories       []string          `yaml:"categories"`
	Filename         string            `yaml:"filename"`
	FormatOverrides  PackagingFormat   `yaml:"formatOverrides"`
	Binary           string            `yaml:"binary"`
	TargetBinary     string            `yaml:"targetBinary"`
	TargetDirectory  string            `yaml:"targetDirectory"`
	AdditionBinaries []string          `yaml:"additionBinaries"`
	FromSource       bool              `yaml:"fromSource"`
	URL              string            `yaml:"url"`
	Tar              string            `yaml:"tar"`
	LatestVersion    string            `yaml:"latestVersion"`
	SupportOS        []string          `yaml:"supportOS"`
	SupportArch      []string          `yaml:"supportArch"`
	Replacements     map[string]string `yaml:"replacements"`
	Requirements     []string          `yaml:"requirements"`
	Installation     *CmdWithArgs      `yaml:"installation"`
	PreInstalls      []CmdWithArgs     `yaml:"preInstalls"`
	PostInstalls     []CmdWithArgs     `yaml:"postInstalls"`
	TestInstalls     []CmdWithArgs     `yaml:"testInstalls"`
	Version          string            `yaml:"version"`

	Org, Repo string
}

HDConfig is the config of http-downloader

func FindPackagesByCategory added in v0.0.53

func FindPackagesByCategory(category string) (result []HDConfig)

FindPackagesByCategory returns the HDConfigs by category

type HDPackage

type HDPackage struct {
	Name             string
	Version          string // e.g. v1.0.1
	VersionNum       string // e.g. 1.0.1
	OS               string // e.g. linux, darwin
	Arch             string // e.g. amd64
	AdditionBinaries []string
}

HDPackage represents a package of http-downloader

type Installer

type Installer struct {
	Package          *HDConfig
	Tar              bool
	Output           string
	TargetDirectory  string
	Source           string
	Name             string
	CleanPackage     bool
	Provider         string
	OS               string
	Arch             string
	Fetch            bool
	AdditionBinaries []string

	Org  string
	Repo string
}

Installer is a tool to install a package

func (*Installer) CheckDepAndInstall

func (o *Installer) CheckDepAndInstall(tools map[string]string) (err error)

CheckDepAndInstall checks the desired tools, install the missing packages

func (*Installer) GetVersion added in v0.0.40

func (o *Installer) GetVersion(path string) (version string, err error)

GetVersion parse install app info

func (*Installer) Install

func (o *Installer) Install() (err error)

Install installs a package

func (*Installer) OverWriteBinary added in v0.0.34

func (o *Installer) OverWriteBinary(sourceFile, targetPath string) (err error)

OverWriteBinary install a binrary file

func (*Installer) ProviderURLParse

func (o *Installer) ProviderURLParse(path string, acceptPreRelease bool) (packageURL string, err error)

ProviderURLParse parse the URL

type PackagingFormat added in v0.0.43

type PackagingFormat struct {
	Windows string `yaml:"windows"`
	Linux   string `yaml:"linux"`
}

PackagingFormat is used for containing config depending on machine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL