transform

package
v0.0.0-...-39bc41e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	RunCommand(cmd exec.Cmd) error
}

func NewCommandRunner

func NewCommandRunner() CommandRunner

type Factory

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

func NewFactory

func NewFactory() *Factory

func (*Factory) Transforms

func (factory *Factory) Transforms(optionsList []Options) ([]Transform, error)

type FileMoveTransform

type FileMoveTransform struct {
	Options
	// contains filtered or unexported fields
}

func NewFileMoveTransform

func NewFileMoveTransform(options Options, output message.Printer, mover FileMover) *FileMoveTransform

func (*FileMoveTransform) Apply

func (transform *FileMoveTransform) Apply(variables Variables) error

type FileMover

type FileMover interface {
	Move(oldPath string, newPath string) error
}

func NewFileMover

func NewFileMover() FileMover

type FileStringReplacer

type FileStringReplacer interface {
	Replace(filepath string, stringReplace StringReplace, variables Variables) error
}

func NewFileStringReplacer

func NewFileStringReplacer() FileStringReplacer

type FileTransform

type FileTransform struct {
	Options
	// contains filtered or unexported fields
}

func NewFileTransform

func NewFileTransform(
	options Options,
	output message.Printer,
	globber Globber,
	replacer FileStringReplacer,
) *FileTransform

func (*FileTransform) Apply

func (transform *FileTransform) Apply(variables Variables) error

type Globber

type Globber interface {
	Glob(pattern string) (matches []string, err error)
}

func NewGlobber

func NewGlobber() Globber

type InputTransform

type InputTransform struct {
	Options
	// contains filtered or unexported fields
}

func NewInputTransform

func NewInputTransform(options Options, input io.Reader, output message.Printer) *InputTransform

func (*InputTransform) Apply

func (transform *InputTransform) Apply(variables Variables) error

type MockGlobber

type MockGlobber struct {
	mock.Mock
}

func NewMockGlobber

func NewMockGlobber(paths []string, err error) *MockGlobber

func (*MockGlobber) Glob

func (globber *MockGlobber) Glob(pattern string) (matches []string, err error)

type MockTransform

type MockTransform struct {
	mock.Mock
}

func NewMockTransform

func NewMockTransform(variables Variables, err error) *MockTransform

func (*MockTransform) Apply

func (mockTransform *MockTransform) Apply(variables Variables) error

type MockTransformer

type MockTransformer struct {
	mock.Mock
}

func NewMockTransformer

func NewMockTransformer(transforms []Transform, variables Variables, err error) *MockTransformer

func (*MockTransformer) Apply

func (transformer *MockTransformer) Apply(transforms []Transform, variables Variables) error

type Options

type Options struct {
	Arguments            []string      `json:"arguments,omitempty"`
	InputPath            string        `json:"input_path,omitempty"`
	InputVariable        string        `json:"input_variable,omitempty"`
	OutputPath           string        `json:"output_path,omitempty"`
	OutputVariable       string        `json:"output_variable,omitempty"`
	SkipIfVariableExists bool          `json:"skip_if_variable_exists,omitempty"`
	StringPrefix         string        `json:"string_prefix,omitempty"`
	StringReplace        StringReplace `json:"string_replace,omitempty"`
	StringSuffix         string        `json:"string_suffix,omitempty"`
	Type                 Type          `json:"type"`
}

type ScriptTransform

type ScriptTransform struct {
	Options
	// contains filtered or unexported fields
}

func NewScriptTransform

func NewScriptTransform(options Options,
	output message.Printer,
	runner CommandRunner) *ScriptTransform

func (*ScriptTransform) Apply

func (transform *ScriptTransform) Apply(variables Variables) error

type StringReplace

type StringReplace struct {
	Old string `json:"old"`
	New string `json:"new"`
}

func (*StringReplace) Replace

func (stringReplace *StringReplace) Replace(input string, variables Variables) string

type Transform

type Transform interface {
	Apply(variables Variables) error
}

type Transformer

type Transformer interface {
	Apply(transforms []Transform, variables Variables) error
}

func NewTransformer

func NewTransformer() Transformer

type Type

type Type string
const (
	TypeFileMove              Type = "file_move"
	TypeFileStringReplace     Type = "file_string_replace"
	TypeInput                 Type = "input"
	TypeRunScript             Type = "run_script"
	TypeVariableStringReplace Type = "variable_string_replace"
)

type VariableTransform

type VariableTransform struct {
	Options
	// contains filtered or unexported fields
}

func NewVariableTransform

func NewVariableTransform(options Options, output message.Printer) *VariableTransform

func (*VariableTransform) Apply

func (transform *VariableTransform) Apply(variables Variables) error

type Variables

type Variables map[string]string

func NewVariables

func NewVariables() Variables

func (Variables) AddEnv

func (variables Variables) AddEnv()

func (Variables) AddProjectName

func (variables Variables) AddProjectName(projectName string)

Jump to

Keyboard shortcuts

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