software

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlatformLinux is a universal string for linux-based operating systems
	// based on the possible values of runtime.GOOS
	PlatformLinux = "linux"
	// PlatformMac is a universal string for macos-based operating systems
	// based on the possible values of runtime.GOOS
	PlatformMac = "darwin"
	// PlatformWindows is a universal string for windows-based operating systems
	// based on the possible values of runtime.GOOS
	PlatformWindows = "windows"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// Command is the command to run including arguments
	Command []string `json:"command" yaml:"command,omitempty"`
	// ExitCode is the expected exit code we can expect from the command running if defined
	ExitCode int `json:"exitCode" yaml:"exitCode,omitempty"`
	// Stdout is the expected output on stdout if defined
	Stdout *string `json:"stdout" yaml:"stdout,omitempty"`
	// Stderr is the expected output on stderr if defined
	Stderr *string `json:"stderr" yaml:"stderr,omitempty"`
	// contains filtered or unexported fields
}

Check represents a functional check on whether the software exists. It works by running the command as specified in Command and comparing the output with the provided ExitCode, Stdout, and Stderr.

Usage: 1. Use `.Run()` method to run the check, results will be stored in the `.observed` property 1. Use `.Verify()` method to verify that the `.observed` property matches the provided parameters

func (Check) GetObserved

func (check Check) GetObserved() *Check

GetObserved returns the observed results, a nil indicates the check has never been run before

func (*Check) Run

func (check *Check) Run() error

Run executes the check, use check.Verify() to verify the results, if this function returns an error, it's a system-type error meaning it has nothing to do with the command itself, but with it's invocation on the host system

func (Check) Verify

func (check Check) Verify() error

Verify returns nil on veritfication succeeded, returns an error instance containing the reason why verification failed otherwise

type Install added in v0.0.16

type Install struct {
	Link string `json:"link" yaml:"link"`
}

Install defines installation instructions for the software

type Platform added in v0.0.16

type Platform string

Platform should define an operating system

func (Platform) String added in v0.0.16

func (p Platform) String() string

type Platforms added in v0.0.16

type Platforms []Platform

Platforms is a list of platforms

type Software

type Software struct {
	Name        string `json:"name" yaml:"name,omitempty"`
	Description string `json:"description" yaml:"description,omitempty"`
	// Platforms when specified, restricts the operations to run only
	// when the check is being run on the allowed operating systems
	Platforms Platforms `json:"platforms" yaml:"platforms,omitempty"`
	Check     Check     `json:"check" yaml:"check,omitempty"`
	Install   Install   `json:"install" yaml:"install,omitempty"`
}

Software represents a software that should be installed on the user's machine

Jump to

Keyboard shortcuts

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