context

package
v0.26.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MixinOutputsDir represents the directory where mixin output files are written/read
	MixinOutputsDir = "/cnab/app/porter/outputs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CensoredWriter

type CensoredWriter struct {
	// contains filtered or unexported fields
}

CensoredWriter is a writer wrapping the provided io.Writer with logic to censor certain values

func NewCensoredWriter

func NewCensoredWriter(writer io.Writer) *CensoredWriter

NewCensoredWriter returns a new CensoredWriter

func (*CensoredWriter) SetSensitiveValues

func (cw *CensoredWriter) SetSensitiveValues(vals []string)

SetSensitiveValues sets values needing masking for an CensoredWriter

func (*CensoredWriter) Write

func (cw *CensoredWriter) Write(b []byte) (int, error)

Write implements io.Writer's Write method, performing necessary auditing while doing so

type CommandBuilder

type CommandBuilder func(name string, arg ...string) *exec.Cmd

func NewTestCommand

func NewTestCommand() CommandBuilder

type Context

type Context struct {
	Debug bool

	FileSystem *afero.Afero
	In         io.Reader
	Out        io.Writer
	Err        io.Writer
	NewCommand CommandBuilder
	// contains filtered or unexported fields
}

func New

func New() *Context

func (*Context) CopyDirectory

func (c *Context) CopyDirectory(srcDir, destDir string, includeBaseDir bool) error

func (*Context) CopyFile

func (c *Context) CopyFile(src, dest string) error

func (*Context) IsVerbose

func (c *Context) IsVerbose() bool

func (*Context) SetSensitiveValues

func (c *Context) SetSensitiveValues(vals []string)

SetSensitiveValues sets the sensitive values needing masking on output/err streams

func (*Context) SetVerbose

func (c *Context) SetVerbose(value bool)

func (*Context) WriteMixinOutputToFile

func (c *Context) WriteMixinOutputToFile(filename string, bytes []byte) error

WriteMixinOutputToFile writes the provided bytes (representing a mixin output) to a file named by the provided filename in Porter's mixin outputs directory

type TestContext

type TestContext struct {
	*Context

	T *testing.T
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(t *testing.T) *TestContext

NewTestContext initializes a configuration suitable for testing, with the output buffered, and an in-memory file system.

func (*TestContext) AddTestDirectory

func (c *TestContext) AddTestDirectory(srcDir, destDir string)

func (*TestContext) AddTestFile

func (c *TestContext) AddTestFile(src, dest string) []byte

TODO: Replace these functions with a union file system for test data

func (*TestContext) AddTestFileContents

func (c *TestContext) AddTestFileContents(file []byte, dest string) error

func (*TestContext) FindBinDir

func (c *TestContext) FindBinDir() string

func (*TestContext) GetError

func (c *TestContext) GetError() string

GetError returns all text printed to stderr.

func (*TestContext) GetOutput

func (c *TestContext) GetOutput() string

GetOutput returns all text printed to stdout.

Jump to

Keyboard shortcuts

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