api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Core schema
	ErrIsNotInstalled     = errors.New("application is not installed")
	ErrAlreadyInstalled   = errors.New("application is already installed")
	ErrIsUpToDate         = errors.New("application is up to date")
	ErrAlreadyInitialized = errors.New("already initialized! use --force flag")
	ErrNotInitialized     = errors.New("app manager is not initialized. See documentation")
	ErrRepoNotExist       = errors.New("repository is not exist")
	ErrRepoAlreadyExist   = errors.New("repository is already exist")
	ErrNoUpdates          = errors.New("no updates")
	// manifest / schema
	ErrManifestUrlEmpty           = errors.New("manifest: empty url somewhere")
	ErrManifestDescriptionEmpty   = errors.New("manifest: description is empty")
	ErrManifestRequiredAnyExec    = errors.New("manifest: must defined one execute path")
	ErrManifestLicenseNameEmpty   = errors.New("manifest: empty license name")
	ErrManifestUrlPatternRequired = errors.New("manifest: must provide url pattern")
	ErrSchemaIsNotSupportedYet    = errors.New("manifest: this schema is not supported yet")
	ErrSchemaInvalidType          = errors.New("manifest: invalid update schema type")
	ErrSchemaInvalidURL           = errors.New("manifest: invalid github repository url")
	ErrSchemaInvalidPattern       = errors.New("manifest: invalid version pattern")
	ErrSchemaInvalidPath          = errors.New("manifest: invalid path or value is not a string")
	ErrSchemaPathRequired         = errors.New("manifest: path is required")
	ErrSchemaPatternRequired      = errors.New("manifest: regex pattern is required")
	// download / extract
	ErrArchiveInvalidPath = errors.New("extract: invalid file path")
	ErrUnsupportedArchive = errors.New("extract: unsupported archive")
	// inputs
	ErrInputAlreadyExist = errors.New("already exist")
	ErrInputEmpty        = errors.New("must be not empty")
)
View Source
var (
	Path   string
	Config GooConfig
)
View Source
var (
	Version         string
	Timestamp       string
	Revision        string
	ProjectRepoSlug string
)

Functions

func AddRepo

func AddRepo(name, url string) error

func AddRepository

func AddRepository(name, url string) error

func Cleanup

func Cleanup(apps []string, cache bool) error

func GetTimestamp

func GetTimestamp() time.Time

func GetVersion

func GetVersion() version.Version

func Init

func Init(force bool) error

func Install

func Install(apps ...string) error

func RemoveRepo

func RemoveRepo(name string) error

func Setup

func Setup(debug bool, level log.Level) error

func Uninstall

func Uninstall(apps ...string) error

func Update

func Update() error

func Upgrade

func Upgrade(apps ...string) error

Types

type ActionScripts

type ActionScripts struct {
	PreInstall    []string `json:"pre_install,omitempty"`
	PostInstall   []string `json:"post_install,omitempty"`
	PreUpdate     []string `json:"pre_update,omitempty"`
	PostUpdate    []string `json:"post_update,omitempty"`
	PreUninstall  []string `json:"pre_uninstall,omitempty"`
	PostUninstall []string `json:"post_uninstall,omitempty"`
}

type App

type App struct {
	Name string
	// contains filtered or unexported fields
}

func (App) Clean

func (a App) Clean() error

func (App) CurrentVersion

func (a App) CurrentVersion() (string, error)

func (App) GetDeprecation

func (a App) GetDeprecation() *string

func (App) HasUpdate

func (a App) HasUpdate() (bool, error)

func (App) Install

func (a App) Install() error

func (App) IsDeprecated

func (a App) IsDeprecated() (bool, error)

func (App) IsInstalled

func (a App) IsInstalled() bool

func (App) LoadManifest

func (a App) LoadManifest() error

func (App) Manifest

func (a App) Manifest() (*AppManifest, error)

func (App) Uninstall

func (a App) Uninstall() error

func (App) Upgrade

func (a App) Upgrade() error

type AppManifest

type AppManifest struct {
	Description string            `json:"description"`          // Application Description
	Homepage    string            `json:"homepage"`             // Application Homepage
	License     License           `json:"license"`              // Application License
	Actions     *ActionScripts    `json:"actions,omitempty"`    // Action Scripts for each installation interaction
	Executable  []string          `json:"executable,omitempty"` // Executable relative path (without extension)
	Updates     AppUpdateSchema   `json:"updates"`              // Application Updates Schema
	Deprecated  *Deprecated       `json:"deprecated,omitempty"` // Deprecation for Application
	Appendix    map[string]string `json:"appendix,omitempty"`   // Appendix for OS / Architecture
}

func (AppManifest) CheckUpdate

func (m AppManifest) CheckUpdate() (string, string, error)

func (AppManifest) Validate

func (m AppManifest) Validate() error

type AppUpdatePattern

type AppUpdatePattern struct {
	Windows string `json:"windows,omitempty"`
	Linux   string `json:"linux,omitempty"`
	Macos   string `json:"macos,omitempty"`
}

type AppUpdateSchema

type AppUpdateSchema struct {
	OneFile      bool             `json:"one_file"`
	Type         AppUpdateType    `json:"type"`
	URL          string           `json:"url"`
	Pattern      AppUpdatePattern `json:"pattern"`
	Path         *string          `json:"path,omitempty"`
	VersionRegex *string          `json:"version_regex,omitempty"`
}

func (AppUpdateSchema) GetPattern

func (u AppUpdateSchema) GetPattern() string

func (AppUpdateSchema) Validate

func (u AppUpdateSchema) Validate() error

type AppUpdateType

type AppUpdateType int
const (
	AppUpdateHTML AppUpdateType = iota
	AppUpdateXML
	AppUpdateJSON
	AppUpdateGitHub
)

func (AppUpdateType) MarshalJSON

func (t AppUpdateType) MarshalJSON() ([]byte, error)

func (AppUpdateType) String

func (t AppUpdateType) String() string

func (*AppUpdateType) UnmarshalJSON

func (t *AppUpdateType) UnmarshalJSON(data []byte) error

type Apps

type Apps []App

func Applications

func Applications() Apps

func (Apps) Filter

func (apps Apps) Filter(app string, regex bool) (list []App)

func (Apps) GetAll

func (apps Apps) GetAll(app ...string) []App

func (Apps) Installed

func (apps Apps) Installed() []App

type Deprecated

type Deprecated struct {
	Reason      string  `json:"reason" yaml:"reason"`
	Since       string  `json:"since" yaml:"since"`
	Alternative *string `json:"alternative,omitempty" yaml:"alternative,omitempty"`
}

func (*Deprecated) IsDeprecated

func (d *Deprecated) IsDeprecated() bool

type GooConfig

type GooConfig struct {
	Debug           bool      `yaml:"debug"`
	LogLevel        log.Level `yaml:"log_level"`
	LogFormat       string    `yaml:"log_format"`
	LogPanic        log.Level `yaml:"log_panic"`
	FollowRedirects bool      `yaml:"follow_redirects"`
	RedirectCount   int       `yaml:"redirect_count"`
	CheckUpdates    bool      `yaml:"check_updates"`
	SkipFailure     bool      `yaml:"skip_failure"`
}

type License

type License struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

func (License) Validate

func (l License) Validate() error

type Repo

type Repo struct {
	Name string
}

func Repository

func Repository(name string) *Repo

func (Repo) Applications

func (r Repo) Applications() Apps

func (Repo) Delete

func (r Repo) Delete() error

func (Repo) Path

func (r Repo) Path() string

func (Repo) Update

func (r Repo) Update() error

type RepoManager

type RepoManager struct {
	Repo
}

func (RepoManager) AddApplication

func (r RepoManager) AddApplication() error

func (RepoManager) Init

func (r RepoManager) Init() error

func (RepoManager) RemoveApplications

func (r RepoManager) RemoveApplications(names ...string) error

func (RepoManager) Validate

func (r RepoManager) Validate() error

type Repos

type Repos []Repo

func Repositories

func Repositories() Repos

func (Repos) Applications

func (r Repos) Applications() Apps

Jump to

Keyboard shortcuts

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