parsing

package
v0.32.17 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: GPL-2.0, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package parsing provides a parser for pipeline yaml files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	RecursivelyAddImports func(paths []string) ([]string, error)
	// contains filtered or unexported fields
}

Parser reads and parses pipeline files

func NewParser

func NewParser(options ...ParserOption) *Parser

NewParser creates a new Parser

func (*Parser) BuiltInPipelineFilePaths

func (parser *Parser) BuiltInPipelineFilePaths(projectPath string) ([]string, error)

BuiltInPipelineFilePaths lists the file paths of all built-in pipelines

func (*Parser) ParsePipelineFiles

func (parser *Parser) ParsePipelineFiles(allPipelineFilePaths []string, builtIn bool) (
	defaults pipeline.DefaultSettings,
	definitions pipeline.DefinitionsLookup,
	files []pipeline.File,
	returnErr error,
)

ParsePipelineFiles processes

func (*Parser) ProcessPipelineFile

func (parser *Parser) ProcessPipelineFile(
	pipelineFile pipeline.File,
	builtIn bool,
) pipeline.DefinitionsLookup

ProcessPipelineFile parses the specified yaml pipeline file

func (*Parser) UserPipelineFilePaths

func (parser *Parser) UserPipelineFilePaths(args []string) ([]string, error)

UserPipelineFilePaths lists the file paths of all user-defined pipelines

type ParserOption

type ParserOption func(parser *Parser)

ParserOption represents an option that can be passed to the `NewParser` constructor

func WithFindByGlobImplementation

func WithFindByGlobImplementation(findByGlob func(pattern string) ([]string, error)) ParserOption

WithFindByGlobImplementation sets the implementation of the function finding files by glob

Useful for tests.

func WithReadFileImplementation

func WithReadFileImplementation(readFile func(filename string) ([]byte, error)) ParserOption

WithReadFileImplementation sets the implementation of the function reading a file's content

Useful for tests.

func WithRecursivelyAddImportsImplementation

func WithRecursivelyAddImportsImplementation(recursivelyAddImports func(paths []string) ([]string, error)) ParserOption

WithRecursivelyAddImportsImplementation sets the implementation of the function that recursively adds imports

Useful for tests.

Jump to

Keyboard shortcuts

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