Documentation ¶
Index ¶
- func ContainsInt(s []int, e int) bool
- func ContainsString(s []string, e string) bool
- func ContainsStringPart(s []string, part string) bool
- func Copy(src, dst string) (int64, error)
- func CopyAtoB(a, b interface{})
- func CopyData(dst io.Writer, src io.Reader) (int64, error)
- func EncodeString(token string) string
- func EncodeUsernamePassword(username, password string) string
- func ExcludeFiles(files, excludes []string) ([]string, error)
- func ExecuteTemplate(txtTemplate string, context interface{}) (string, error)
- func ExecuteTemplateFunctions(txtTemplate string, functionMap template.FuncMap, context interface{}) (string, error)
- func FileExists(filename string) (bool, error)
- func FindString(s []string, e string) int
- func PersistReportsAndLinks(stepName, workspace string, reports, links []Path)
- func Prefix(in []string, prefix string) []string
- func PrefixIfNeeded(in []string, prefix string) []string
- func RemoveAll(s []string, e string) ([]string, bool)
- func SplitAndTrim(in []string, separator string) (out []string)
- func Title(in string) string
- func Trim(in []string) (out []string)
- func UniqueStrings(values []string) []string
- func Untar(src string, dest string, stripComponentLevel int) error
- func Unzip(src, dest string) ([]string, error)
- type FileUtils
- type Files
- func (f Files) Abs(path string) (string, error)
- func (f Files) Chdir(path string) error
- func (f Files) Chmod(path string, mode os.FileMode) error
- func (f Files) Copy(src, dst string) (int64, error)
- func (f Files) Create(name string) (io.ReadWriteCloser, error)
- func (f Files) CurrentTime(format string) string
- func (f Files) DirExists(path string) (bool, error)
- func (f Files) FileExists(filename string) (bool, error)
- func (f *Files) FileOpen(name string, flag int, perm os.FileMode) (*os.File, error)
- func (f Files) FileRead(path string) ([]byte, error)
- func (f Files) FileRemove(path string) error
- func (f Files) FileRename(oldPath, newPath string) error
- func (f Files) FileWrite(path string, content []byte, perm os.FileMode) error
- func (f Files) Getwd() (string, error)
- func (f Files) Glob(pattern string) (matches []string, err error)
- func (f Files) MkdirAll(path string, perm os.FileMode) error
- func (f Files) Move(src, dst string) error
- func (f Files) Open(name string) (io.ReadWriteCloser, error)
- func (f Files) RemoveAll(path string) error
- func (f Files) SHA256(path string) (string, error)
- func (f Files) Stat(path string) (os.FileInfo, error)
- func (f Files) Symlink(oldname, newname string) error
- func (f Files) TempDir(dir, pattern string) (name string, err error)
- type Path
- type ProjectStructure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsInt ¶
ContainsInt checks whether the element is part of the slice
func ContainsString ¶
ContainsString checks whether the element is part of the slice
func ContainsStringPart ¶
ContainsStringPart checks whether the element is contained as part of one of the elements of the slice
func CopyAtoB ¶
func CopyAtoB(a, b interface{})
CopyAtoB copies the contents of a into slice b given that they are of equal size and compatible type
func CopyData ¶
CopyData transfers the bytes from src to dst without doing close handling implicitly.
func EncodeString ¶
func EncodeUsernamePassword ¶
func ExcludeFiles ¶
ExcludeFiles returns a slice of files, which contains only the sub-set of files that matched none of the glob patterns in the provided excludes list.
func ExecuteTemplate ¶
ExecuteTemplate parses the provided template, substitutes values and returns the output
func ExecuteTemplateFunctions ¶
func ExecuteTemplateFunctions(txtTemplate string, functionMap template.FuncMap, context interface{}) (string, error)
ExecuteTemplateFunctions parses the provided template, applies the transformation functions, substitutes values and returns the output
func FileExists ¶
FileExists returns true if the file system entry for the given path exists and is not a directory.
func FindString ¶
FindString returns the position of element e in the given slice or -1 if it's not in
func PersistReportsAndLinks ¶
PersistReportsAndLinks stores the report paths and links in JSON format in the workspace for processing outside
func PrefixIfNeeded ¶
PrefixIfNeeded adds a prefix to each element of the slice if not already prefixed
func RemoveAll ¶
RemoveAll removes all instances of element from the slice and returns a truncated slice as well as a boolean to indicate whether at least one element was found and removed.
func SplitAndTrim ¶
SplitAndTrim iterates over the strings in the given slice and splits each on the provided separator. Each resulting sub-string is then a separate entry in the returned array.
func Trim ¶
Trim removes dangling whitespaces from each element of the slice, empty elements are dropped
func UniqueStrings ¶
UniqueStrings removes duplicates from values
func Unzip ¶
Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2). from https://golangcode.com/unzip-files-in-go/ with the following license: MIT License
Copyright (c) 2017 Edd Turtle ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Types ¶
type FileUtils ¶
type FileUtils interface { Abs(path string) (string, error) DirExists(path string) (bool, error) FileExists(filename string) (bool, error) Copy(src, dest string) (int64, error) Move(src, dest string) error FileRead(path string) ([]byte, error) FileWrite(path string, content []byte, perm os.FileMode) error FileRemove(path string) error MkdirAll(path string, perm os.FileMode) error Chmod(path string, mode os.FileMode) error Glob(pattern string) (matches []string, err error) Chdir(path string) error TempDir(string, string) (string, error) RemoveAll(string) error FileRename(string, string) error Getwd() (string, error) Symlink(oldname string, newname string) error SHA256(path string) (string, error) CurrentTime(format string) string Open(name string) (io.ReadWriteCloser, error) Create(name string) (io.ReadWriteCloser, error) }
FileUtils ...
type Files ¶
type Files struct { }
Files ...
func (Files) Create ¶
func (f Files) Create(name string) (io.ReadWriteCloser, error)
Create is a wrapper for os.Create
func (Files) CurrentTime ¶
CurrentTime returns the current time in the specified format
func (Files) DirExists ¶
DirExists returns true if the file system entry for the given path exists and is a directory.
func (Files) FileExists ¶
FileExists returns true if the file system entry for the given path exists and is not a directory.
func (Files) FileRemove ¶
FileRemove is a wrapper for os.Remove().
func (Files) FileRename ¶
FileRename is a wrapper for os.Rename().
func (Files) Open ¶
func (f Files) Open(name string) (io.ReadWriteCloser, error)
Open is a wrapper for os.Open
type Path ¶
type Path struct { Name string `json:"name"` Target string `json:"target"` Mandatory bool `json:"mandatory"` Scope string `json:"scope"` }
Path - struct to serialize paths and some metadata back to the invoker
type ProjectStructure ¶
type ProjectStructure struct {
// contains filtered or unexported fields
}
ProjectStructure describes a directory containing source code
func (*ProjectStructure) UsesMaven ¶
func (projectStructure *ProjectStructure) UsesMaven() bool
UsesMaven returns `true` if the project structure directory contains a pom.xml file, false otherwise
func (*ProjectStructure) UsesMta ¶
func (projectStructure *ProjectStructure) UsesMta() bool
UsesMta returns `true` if the project structure directory contains typical files for mta projects (mta.yaml, mta.yml), `false` otherwise
func (*ProjectStructure) UsesNpm ¶
func (projectStructure *ProjectStructure) UsesNpm() bool
UsesNpm returns `true` if the project structure directory contains a package.json file, false otherwise