Documentation ¶
Overview ¶
Package common functions shared across all files
Index ¶
- Constants
- func AppendProperties(propertiesFile string, properties ...*Property) error
- func AppendToFile(srcFile, destFile string) error
- func CopyFile(src, dest string) error
- func DirExists(dirPath string) bool
- func ExecutableName() string
- func ExecuteCommand(command []string, workingDir string, outputStreamWriter io.Writer, ...) (*exec.Cmd, error)
- func ExecuteCommandWithEnv(command []string, workingDir string, outputStreamWriter io.Writer, ...) (*exec.Cmd, error)
- func ExecuteSystemCommand(command []string, workingDir string, outputStreamWriter io.Writer, ...) (*exec.Cmd, error)
- func FileExists(path string) bool
- func FindFilesInDir(dirPath string, isValidFile func(path string) bool, ...) []string
- func GetConfigurationDir() (string, error)
- func GetDefaultPropertiesFile() (string, error)
- func GetDirInProject(dirName string, specPath string) (string, error)
- func GetExecutableCommand(isSystemCommand bool, command ...string) *exec.Cmd
- func GetGaugeConfiguration() (properties.Properties, error)
- func GetGaugeConfigurationFor(propertiesFileName string) (properties.Properties, error)
- func GetGaugeHomeDirectory() (string, error)
- func GetGaugePluginVersion(pluginName string) (string, error)
- func GetInstallationPrefix() (string, error)
- func GetPluginInstallPrefixes() ([]string, error)
- func GetPluginProperties(jsonPropertiesFile string) (map[string]interface{}, error)
- func GetPluginsInstallDir(pluginName string) (string, error)
- func GetPrimaryPluginsInstallDir() (string, error)
- func GetProjectRoot() (string, error)
- func GetProjectRootFromSpecPath(specPath string) (string, error)
- func GetSkeletonFilePath(filename string) (string, error)
- func GetTempDir() string
- func GetUniqueID() int64
- func IsPluginInstalled(name, version string) bool
- func MirrorDir(src, dst string) ([]string, error)
- func MirrorFile(src, dst string) error
- func ReadFileContents(file string) (string, error)
- func Remove(path string) error
- func SaveFile(filePath, contents string, takeBackup bool) error
- func SetEnvVariable(key, value string) error
- func SubDirectoryExists(pluginDir string, pluginName string) bool
- func TrimTrailingSpace(str string) string
- func UnzipArchive(zipFile string, dest string) (string, error)
- func UrlExists(url string) (bool, error)
- type Property
Constants ¶
const ( ManifestFile = "manifest.json" PluginJSONFile = "plugin.json" NewDirectoryPermissions = 0755 NewFilePermissions = 0644 DefaultEnvFileName = "default.properties" EnvDirectoryName = "env" DefaultEnvDir = "default" ProductName = "gauge" DotGauge = ".gauge" SpecsDirectoryName = "specs" ConceptFileExtension = ".cpt" Plugins = "plugins" GaugePropertiesFile = "gauge.properties" NightlyDatelayout = "2006-01-02" )
const ( GaugeProjectRootEnv = "GAUGE_PROJECT_ROOT" GaugeHome = "GAUGE_HOME" //specifies the plugin installation path if installs to non-standard location GaugePortEnvName = "GAUGE_PORT" // user specifies this to use a specific port GaugeInternalPortEnvName = "GAUGE_INTERNAL_PORT" APIPortEnvVariableName = "GAUGE_API_PORT" APIV2PortEnvVariableName = "GAUGE_API_V2_PORT" GaugeDebugOptsEnv = "GAUGE_DEBUG_OPTS" //specify the debug options to be used while launching the runner )
Variables ¶
This section is empty.
Functions ¶
func AppendProperties ¶
AppendProperties appends the given properties to the end of the properties file.
func AppendToFile ¶
Appends contents of source file to destination file. If destination file is not present, Copy file action is performed
func ExecutableName ¶
func ExecutableName() string
ExecutableName returns the Gauge executable name based on user's OS
func ExecuteCommand ¶
func ExecuteCommand(command []string, workingDir string, outputStreamWriter io.Writer, errorStreamWriter io.Writer) (*exec.Cmd, error)
ExecuteCommand executes the given command in the working directory.
func ExecuteCommandWithEnv ¶
func ExecuteCommandWithEnv(command []string, workingDir string, outputStreamWriter io.Writer, errorStreamWriter io.Writer, env []string) (*exec.Cmd, error)
ExecuteCommandWithEnv executes command after setting the given environment
func ExecuteSystemCommand ¶
func ExecuteSystemCommand(command []string, workingDir string, outputStreamWriter io.Writer, errorStreamWriter io.Writer) (*exec.Cmd, error)
ExecuteSystemCommand executes the given system command in the working directory.
func FindFilesInDir ¶
func FindFilesInDir(dirPath string, isValidFile func(path string) bool, shouldSkip func(path string, f os.FileInfo) bool) []string
FindFilesInDir returns a list of files for which isValidFile func returns true
func GetConfigurationDir ¶
GetConfigurationPrefix returns the configuration directory prefix $GAUGE_HOME or $home/.gauge/config
func GetDefaultPropertiesFile ¶
GetDefaultPropertiesFile returns the path of the default.properties file in the default env
func GetDirInProject ¶
GetDirInProject returns the path of a particular directory in a Gauge project
func GetExecutableCommand ¶
GetExecutableCommand returns the path of the executable file
func GetGaugeConfiguration ¶
func GetGaugeConfiguration() (properties.Properties, error)
GetGaugeConfiguration parsed the gauge.properties file from GAUGE_HOME and returns the contents
func GetGaugeConfigurationFor ¶
func GetGaugeConfigurationFor(propertiesFileName string) (properties.Properties, error)
GetGaugeConfiguration parsed the given properties file from GAUGE_HOME and returns the contents
func GetGaugeHomeDirectory ¶
GetGaugeHomeDirectory returns GAUGE_HOME. This is where all the plugins are installed
func GetGaugePluginVersion ¶
GetGaugePluginVersion returns the latest version installed of the given plugin
func GetInstallationPrefix ¶
GetInstallationPrefix returns the installation directory prefix /usr or /usr/local
func GetPluginInstallPrefixes ¶
GetPluginInstallPrefixes returns the installation prefix path for the plugins
func GetPluginProperties ¶
GetPluginProperties returns the properties of the given plugin.
func GetPluginsInstallDir ¶
GetPluginsInstallDir returns the plugin installation directory
func GetPrimaryPluginsInstallDir ¶
GetPrimaryPluginsInstallDir returns the primary plugin installation dir
func GetProjectRoot ¶
GetProjectRoot returns the Gauge project root A project root is where a manifest.json files exists this routine keeps going upwards searching for manifest.json
func GetProjectRootFromSpecPath ¶
GetProjectRootFromSpecPath returns the path of the project root from a given spec path
func GetSkeletonFilePath ¶
GetSkeletonFilePath returns the path skeleton file
func IsPluginInstalled ¶
IsPluginInstalled checks if the given Gauge plugin version is installed
func MirrorDir ¶
MirrorDir creates an exact copy of source dir to destination dir Modified version of bradfitz's camlistore (https://github.com/bradfitz/camlistore/blob/master/make.go)
func MirrorFile ¶
MirrorFile creates an exact copy of source file to destination file Modified version of bradfitz's camlistore (https://github.com/bradfitz/camlistore/blob/master/make.go)
func ReadFileContents ¶
ReadFileContents returns the contents of the file
func SetEnvVariable ¶
SetEnvVariable is a wrapper around os.SetEnv to set env variable
func SubDirectoryExists ¶
SubDirectoryExists checks if a dir for given plugin exists in the plugin directory
func TrimTrailingSpace ¶
TrimTrailingSpace trims the trailing spaces in the given string
func UnzipArchive ¶
UnzipArchive extract the zip file to destination directory