utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 137

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTrailingSlashIfNeeded

func AddTrailingSlashIfNeeded(url string) string

func Bool2Int

func Bool2Int(b bool) int

func BuildTargetPath

func BuildTargetPath(pattern, path, target string, ignoreRepo bool) (string, error)

Replaces matched regular expression from path to corresponding {i} at target. Example 1:

pattern = "repoA/1(.*)234" ; path = "repoA/1hello234" ; target = "{1}" ; ignoreRepo = false
returns "hello"

Example 2:

pattern = "repoA/1(.*)234" ; path = "repoB/1hello234" ; target = "{1}" ; ignoreRepo = true
returns "hello"

func CopyMap

func CopyMap(src map[string]string) (dst map[string]string)

func GetLogMsgPrefix

func GetLogMsgPrefix(threadId int, dryRun bool) string

func GetMapFromStringSlice

func GetMapFromStringSlice(slice []string, sep string) map[string]string

func GetRootPath

func GetRootPath(path string, useRegExp bool) string

Get the local root path, from which to start collecting artifacts to be used for: 1. Uploaded to Artifactory, 2. Adding to the local build-info, to be later published to Artifactory.

func GetUserAgent

func GetUserAgent() string

func GetUserHomeDir

func GetUserHomeDir() string

func IndentJson

func IndentJson(jsonStr []byte) string

func IsWindows

func IsWindows() bool

func MergeMaps

func MergeMaps(src map[string]string, dst map[string]string)

func PrepareLocalPathForUpload

func PrepareLocalPathForUpload(localPath string, useRegExp bool) string

func ReplaceTildeWithUserHome

func ReplaceTildeWithUserHome(path string) string

func SetUserAgent

func SetUserAgent(newUserAgent string)

func SplitWithEscape

func SplitWithEscape(str string, separator rune) []string

Split str by the provided separator, escaping the separator if it is prefixed by a back-slash.

func StringToBool

func StringToBool(boolVal string, defaultValue bool) (bool, error)

func TrimPath

func TrimPath(path string) string

Types

type Artifact

type Artifact struct {
	LocalPath  string
	TargetPath string
	Symlink    string
}

Jump to

Keyboard shortcuts

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