util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 License: Apache-2.0 Imports: 17 Imported by: 41

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ApplyDockerIgnore

func ApplyDockerIgnore(paths []string, dockerIgnorePath string) ([]string, error)

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to a bool

func CreateTarGz

func CreateTarGz(w io.Writer, root string, paths []string) error

func ExpandPaths

func ExpandPaths(workspace string, paths []string) ([]string, error)

ExpandPaths uses a filepath.Match to expand paths according to wildcards. It requires a workspace directory, which is walked and tested for wildcard matches It is used by the dockerfile parser and you most likely want to use ExpandPathsGlob

func ExpandPathsGlob

func ExpandPathsGlob(paths []string) ([]string, error)

ExpandPathsGlob expands paths according to filepath.Glob patterns Returns a list of unique files that match the glob patterns passed in.

func IsSupportedKubernetesFormat

func IsSupportedKubernetesFormat(n string) bool

IsSupportedKubernetesFormat is for determining if a file under a glob pattern is deployable file format. It makes no attempt to check whether or not the file is actually deployable or has the correct contents.

func RandomID

func RandomID() string

func ResetDefaultExecCommand

func ResetDefaultExecCommand()

func ResetFs

func ResetFs()

func RunCommand

func RunCommand(cmd *exec.Cmd, stdin io.Reader) ([]byte, []byte, error)

func StrSliceContains

func StrSliceContains(sl []string, s string) bool

Types

type Command

type Command interface {
	RunCommand(cmd *exec.Cmd, stdin io.Reader) ([]byte, []byte, error)
}

Command is an interface used to run commands. All packages should use this interface instead of calling exec.Cmd directly.

var DefaultExecCommand Command

DefaultExecCommand runs commands using exec.Cmd

type Commander

type Commander struct{}

Commander is the exec.Cmd implementation of the Command interface

func (*Commander) RunCommand

func (*Commander) RunCommand(cmd *exec.Cmd, stdin io.Reader) ([]byte, []byte, error)

RunCommand runs an exec.Command, optionally reading from stdin and return the stdout, stderr, and error responses respectively.

Jump to

Keyboard shortcuts

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