stack

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportedStackStrings

func SupportedStackStrings() []string

SupportedStackStrings returns a slice of all String values of the enum

Types

type Handler

type Handler interface {
	FetchPackages() ([]Package, error)
}

Handler is an interface representing the ability to build a list of Package from the information that a struct has.

func CreateStackHandler

func CreateStackHandler(stack SupportedStack, version, bundle string) Handler

CreateStackHandler constructs and returns a stack handler if supported. It returns nil otherwise.

Note: bundle is ignored if selected stack is known for not to be split in bundles.

type KDEHandler

type KDEHandler struct {
	BaseURL string
	Bundle  string
	Version string
}

KDEHandler returns a list of packages by parsing an HTML page from the KDE project. Since KDE is split among various bundles, this struct keeps only track of one of them. If you need to handle multiple bundles, you'll need to instantiate multiple KDE objects.

func NewKDEHandler

func NewKDEHandler(bundle, version string) KDEHandler

NewKDEHandler returns a struct to handle the KDE stack, with a default base URL.

func (KDEHandler) FetchPackages

func (kde KDEHandler) FetchPackages() ([]Package, error)

FetchPackages returns a list of Package objects belonging to the bundle and version specified in the KDE handler.

type Package

type Package struct {
	Name    string
	Version string
	URL     string
}

Package represents a piece of software from a certain stack.

func PackageFromFilename

func PackageFromFilename(filename, url string) (Package, error)

PackageFromFilename parses a package's filename and returns a stack.Package instance if all was successful. It expects a filename structured in this way: `pkgname-version.some.extension`.

PackageFromFilename also takes a `url` argument since there's no way to get it from a filename.

func (Package) Download

func (pkg Package) Download() (io.ReadCloser, error)

Download downloads the package's tarball

type SupportedStack

type SupportedStack int

SupportedStack represents a stack supported by this package.

const (
	// KDE enum
	KDE SupportedStack = iota
)

func SupportedStackString

func SupportedStackString(s string) (SupportedStack, error)

SupportedStackString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func SupportedStackValues

func SupportedStackValues() []SupportedStack

SupportedStackValues returns all values of the enum

func (SupportedStack) IsASupportedStack

func (i SupportedStack) IsASupportedStack() bool

IsASupportedStack returns "true" if the value is listed in the enum definition. "false" otherwise

func (SupportedStack) String

func (i SupportedStack) String() string

Jump to

Keyboard shortcuts

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