Documentation ¶
Index ¶
- Constants
- func CopyDir(src, dst string)
- func CopyFile(src, dst string, mode os.FileMode)
- func CreateDir(targetDir, dirPath string, mode os.FileMode)
- func CreateFile(src io.Reader, targetdir, filename string, mode os.FileMode)
- func CreateFile2(file *zip.File, targetdir, filename string, mode os.FileMode)
- func DeepCopy(src interface{}) interface{}
- func DownloadFile(file, url string)
- func DownloadGit(src, dst string)
- func Exec(id, outDir string, v Variables, cmd string, args ...string)
- func FileExists(filename string) bool
- func FileMD5(path string) []byte
- func FilenameFromURL(URL string) string
- func GetUniqueFilename(id, outDir string) string
- func Install(src, dst string, mode os.FileMode)
- func IsDir(p string) bool
- func PathExists(path string) bool
- func UnpackAssets(dstDir string, assets http.FileSystem) error
- func UnpackFile(filePath string, targetDir string)
- func Unzip(src, dest string) error
- type Variables
- func (v *Variables) Append(vals Variables)
- func (v Variables) AppendEnv(env []string) []string
- func (v Variables) Copy(keys ...string) Variables
- func (v Variables) Dump()
- func (v Variables) ExportEnv() []string
- func (v Variables) Get(key string) string
- func (v *Variables) ImportEnv(env []string)
- func (v Variables) IsNull() bool
- func (v Variables) Names() []string
- func (v *Variables) PrependEnv(key string, value string)
- func (v Variables) Printf(format string, args ...interface{})
- func (v Variables) Resolve(str string) string
- func (v *Variables) ResolveAll()
- func (v *Variables) Set(key string, val interface{})
Constants ¶
const ( // CompressorNone - uncompressed file CompressorNone = iota // CompressorGzip indicates that the file i compressed using gzip CompressorGzip // CompressorBzip2 indicates a bzip2 compressor CompressorBzip2 // CompressorZip indicates a zlib compressor CompressorZip // CompressorXZ indicates a xz compressor CompressorXZ )
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
CreateFile creates a file from an io.Reader with a given mode
func CreateFile2 ¶
CreateFile2 creates a file from an io.Reader with a given mode
func DeepCopy ¶
func DeepCopy(src interface{}) interface{}
DeepCopy copies all public properties of src into the return value, that is a value of the same type as src.
func DownloadFile ¶
func DownloadFile(file, url string)
DownloadFile downloads a file to a specific location
func DownloadGit ¶
func DownloadGit(src, dst string)
DownloadGit downloads a url in the form src = https://github.com/staffano/sonbyg git clone https://github.com/staffano/sonbyg dst is the directory that maps to sonbyg.
func Exec ¶
Exec runs a command and stores the stdout/stderr to a file named <outDir>/<id>.<nr>, where nr is a number that makes the filename unique within the directory.
func FileExists ¶
FileExists returns true if there is a file at the path
func FilenameFromURL ¶
FilenameFromURL extracts the filename from an URL
func GetUniqueFilename ¶
GetUniqueFilename returns a path in the form <outDir>/<id>.<nr>, where the nr is generated in a way to make the path unique.
func UnpackAssets ¶
func UnpackAssets(dstDir string, assets http.FileSystem) error
UnpackAssets unpacks assets into a destination directory
Types ¶
type Variables ¶
type Variables map[string]interface{}
Variables represents a map of variables.
func NewVariables ¶
NewVariables creates a new Variables object and import the environment variables
func (Variables) AppendEnv ¶
AppendEnv takes an existing env and merges in (overwrites) the variables
func (Variables) Copy ¶
Copy will select the keys from variables and create a new variables. if "all" is specified all variables will be copied.
func (Variables) ExportEnv ¶
ExportEnv exports environment variables in the form "key=val" The value will use the default string conversion of the underlying type
func (*Variables) PrependEnv ¶
PrependEnv prepends the value to the variable with key. If the key variable is not an environment list variable, the result is unknown
func (Variables) Printf ¶
Printf will check the existence of VERBOSE and log accordingly If "DEBUG_BUILD" is set, then all variables will be printed
func (Variables) Resolve ¶
Resolve the string and replace all variable references with values from the Variables
func (*Variables) ResolveAll ¶
func (v *Variables) ResolveAll()
ResolveAll will resolve all variable references within Variables