Documentation
¶
Index ¶
- func ArchiveUrl(repoUrl, ref string, trunk string, token string) (string, error)
- func BuildCommand(command string, arguments string) (string, []string)
- func BuildGitHubAPIUrl(repoUrl string, ref string, trunk string, archive bool, token string) string
- func CallHTTPAPI(url string, token string) (map[string]interface{}, error)
- func CheckConnectivity(target string) error
- func Copy(srcFile, dstFile string) error
- func CopyDirectory(srcDir, dest string) error
- func CopySymLink(source, dest string) error
- func CreateIfNotExists(dir string, perm os.FileMode) error
- func Exists(filePath string) bool
- func GetDefaultCacheDir() string
- func GetDefaultTempDir() string
- func GetDefaultWorkingDir() string
- func GetFileContent(path string) ([]byte, error)
- func GetFileList(pattern string, parent string) ([]string, error)
- func GetGitHubArchiveUrl(path string, token string) (string, error)
- func GetPlatformOS() string
- func GetStacksCLIDir() string
- func GetUserHomeDir() string
- func GetValueByDottedPath(data interface{}, path string) (interface{}, error)
- func GitClone(repoUrl, ref, trunk string, tmpPath string, token string) (string, error)
- func IsEmpty(name string) (bool, error)
- func IsUnixShell() bool
- func NestedMapLookup(m map[string]interface{}, ks ...string) (rval interface{}, err error)
- func NormalisePath(path string, separator string) string
- func RandomString(length int) string
- func SliceContains(slice []string, value string) bool
- func TransformCRLF(input string) string
- func Unzip(src, dest string) (string, error)
- func WriteYAMLToFile(object interface{}, path string, perm uint32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArchiveUrl ¶
ArchiveUrl returns the archive url for the repo at a given commit hash or branch or v release
func BuildCommand ¶
BuildCommand builds up the command to be used, depending on the OS in use This is required so that on Windows the command is prepended with "cmd /C" and the arguments need to be split up into a slice so that they are passed to the exec.Command method
func BuildGitHubAPIUrl ¶
func CheckConnectivity ¶
func CopyDirectory ¶
using this as an inspiration https://github.com/moby/moby/blob/master/daemon/graphdriver/copy/copy.go CopyDirectory
func CopySymLink ¶
func GetDefaultCacheDir ¶
func GetDefaultCacheDir() string
GetDefaultCacheDir returns the directory that should be used for caching all downloads that the CLI makes
func GetDefaultTempDir ¶
func GetDefaultTempDir() string
GetDefaultTempDir determines the path to be used for the temporary directory It does not create it, but it will be set in the config for the CLI to create as and when it is required
func GetDefaultWorkingDir ¶
func GetDefaultWorkingDir() string
GetDefaultWorkingDir returns the current directory as the default working directory for where projects will be created
func GetFileContent ¶ added in v0.4.17
func GetFileList ¶ added in v0.4.17
GetFileList returns a list of files that match the specified pattern
func GetPlatformOS ¶
func GetPlatformOS() string
GetPlatformOS is a helper function to the runtime environment variable
func GetStacksCLIDir ¶ added in v0.4.17
func GetStacksCLIDir() string
GetStacksCLIDir returns the directory that should be used for storing all configuration
func GetUserHomeDir ¶
func GetUserHomeDir() string
GetUserHomeDir returns the currenmt users home directory
func GetValueByDottedPath ¶
GetValueByDottedPath returns the value of a field in a struct by using a string This is useful when checking the values of a struct for a specific value, or if it is null The string must be names of the attributes in the struct and not the ones in the mapstructure
func GitClone ¶
GitClone uses standard network library to fetch a defined commit and avoids bloating the binary
func IsUnixShell ¶
func IsUnixShell() bool
IsUnixShell determines if the program is running in a Unix shell. This is required for the situations where Bash is being run on Windows for example.
This function is used to determine if the CLI should use forward slashes in any paths that are generated and shown to the user
func NestedMapLookup ¶
NestedMapLookup m: a map from strings to other maps or values, of arbitrary depth ks: successive keys to reach an internal or leaf node (variadic) If an internal node is reached, will return the internal map
Returns: (Exactly one of these will be nil) rval: the target node (if found) err: an error created by fmt.Errorf
func NormalisePath ¶
Normalise paths ensures that the path separator is correct for the specified platform
func RandomString ¶
RandomString returns a string with the specified number of characters. Useful for creating temporary filenames etc Uses the crypto random generator so as to always give a new string, using time as the seed was not fast enough for the tests.
func SliceContains ¶
func TransformCRLF ¶
TransformCRLF takes an input and ensures that all line endings are in LF This is to ensure that files read on a Windows machine behave as required with some libraries
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). Returns all unzipped files (abs path)
func WriteYAMLToFile ¶
Types ¶
This section is empty.