recipe

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AnyOS = "any"

AnyOS is OS string that matches any operating system

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Get(url string) (resp *http.Response, err error)
}

HTTPClient is an interface that is used for HTTP requests

type Recipe

type Recipe struct {
	OS       string       `yaml:"os",json:"os"`
	Metadata UnitMetadata `yaml:"metadata",json:"metadata"`
	Stages   []Stage      `yaml:"stages",json:"stages"`
}

Recipe stores needed steps to install a gjven piece of functionality

func FromPath

func FromPath(path string) (*Recipe, error)

FromPath creates a Recipe from given file

func FromRepository

func FromRepository(recipeName string, httpClient HTTPClient) (*Recipe, error)

FromRepository downloads a recipe from official recipes repository

func FromURL

func FromURL(url string, httpClient HTTPClient) (*Recipe, int, error)

FromPath downloads a file from given URL and uses it to create a Recipe

func (*Recipe) Validate

func (r *Recipe) Validate() error

Validate checks if the recipe is valid to run on current OS and whether all stages and steps are not empty

type Stage

type Stage struct {
	Metadata UnitMetadata `yaml:"metadata",json:"metadata"`
	Steps    []Step       `yaml:"steps",json:"steps"`
}

Stage represents a logical part of recipe that consists of steps

type Step

type Step struct {
	Metadata UnitMetadata  `yaml:"metadata",json:"metadata"`
	Execute  shell.Command `yaml:"execute",json:"execute"`
	Rollback shell.Command `yaml:"rollback",json:"rollback"`
}

Step contains data about a single shell command, which can be installed or reverted

type UnitMetadata

type UnitMetadata struct {
	Name        string `yaml:"name",json:"name"`
	Description string `yaml:"description",json:"description"`
	URL         string `yaml:"url",json:"url"`
}

UnitMetadata stores metadata for a generic Recipe unit, such as Recipe, Stage or Step

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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