file

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	CurrentContent string
	// contains filtered or unexported fields
}

File defines a resource of kind "file"

func New added in v0.13.0

func New(spec Spec) (*File, error)

New returns a reference to a newly initialized File object from a Spec or an error if the provided Filespec triggers a validation error.

func (*File) Condition

func (f *File) Condition(source string) (bool, error)

Condition test if a file content match the content provided via configuration. If the configuration doesn't specify a value then it fall back to the source output

func (*File) ConditionFromSCM

func (f *File) ConditionFromSCM(source string, scm scm.ScmHandler) (bool, error)

ConditionFromSCM test if a file content from SCM match the content provided via configuration. If the configuration doesn't specify a value then it fall back to the source output

func (*File) Read added in v0.13.0

func (f *File) Read() error

Read defines CurrentContent to the content of the file which path is specified in spec.File

func (*File) Source

func (f *File) Source(workingDir string) (string, error)

Source return a file content

func (*File) Target

func (f *File) Target(source string, dryRun bool) (bool, error)

Target creates or updates a file located locally. The default content is the value retrieved from source

func (*File) TargetFromSCM

func (f *File) TargetFromSCM(source string, scm scm.ScmHandler, dryRun bool) (bool, []string, string, error)

TargetFromSCM creates or updates a file from a source control management system. The default content is the value retrieved from source

func (*File) Validate added in v0.16.1

func (f *File) Validate() error

Validate validates the object and returns an error (with all the failed validation messages) if it is not valid

type Spec added in v0.18.0

type Spec struct {
	File           string
	Line           int
	Content        string
	ForceCreate    bool
	MatchPattern   string
	ReplacePattern string
}

Spec defines a specification for a "file" resource parsed from an updatecli manifest file

Jump to

Keyboard shortcuts

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