utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 41

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExtractorPropsFile

func CreateExtractorPropsFile(configPropertiesPath string, configProperties map[string]string) (string, error)

Save all the extractor's properties into a local file. configPropertiesPath - path to a file where all the properties will be written. configProperties - the actual properties.

func CreateTempBuildFile

func CreateTempBuildFile(buildName, buildNumber, projectKey, buildsDirPath string, logger Log) (*os.File, error)

Create a temp file of build-info.

func DoubleWinPathSeparator

func DoubleWinPathSeparator(filePath string) string

func DownloadDependencies

func DownloadDependencies(downloadTo, filename, relativefilePath string, downloadExtractorFunc func(downloadTo, downloadPath string) error, logger Log) error

func DownloadFile

func DownloadFile(downloadTo string, fromUrl string) (err error)

func GetBuildDir

func GetBuildDir(buildName, buildNumber, projectKey, buildsDirPath string) (string, error)

func GetPartialsBuildDir

func GetPartialsBuildDir(buildName, buildNumber, projectKey, buildsDirPath string) (string, error)

func IsDirExists

func IsDirExists(path string) (bool, error)

func IsFileExists

func IsFileExists(path string) (bool, error)

func IsPathExists

func IsPathExists(path string) bool

Check if path exists.

func ListFiles

func ListFiles(path string) ([]string, error)

ListFiles returns a list of files and directories in the specified path

func NewDefaultLogger

func NewDefaultLogger(logLevel LevelType) *defaultLogger

NewDefaultLogger creates a new logger with a given LogLevel. All logs are written to Stderr and output is written to Stdout.

Types

type LevelType

type LevelType int
const (
	ERROR LevelType = iota
	WARN
	INFO
	DEBUG
)

type Log

type Log interface {
	Debug(a ...interface{})
	Info(a ...interface{})
	Warn(a ...interface{})
	Error(a ...interface{})
	Output(a ...interface{})
}

type NullLog

type NullLog struct {
}

NullLog is a logger that does nothing

func (*NullLog) Debug

func (nl *NullLog) Debug(...interface{})

func (*NullLog) Error

func (nl *NullLog) Error(...interface{})

func (*NullLog) Info

func (nl *NullLog) Info(...interface{})

func (*NullLog) Output

func (nl *NullLog) Output(...interface{})

func (*NullLog) Warn

func (nl *NullLog) Warn(...interface{})

Jump to

Keyboard shortcuts

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