Documentation
¶
Index ¶
- Constants
- func AddData(key string, data map[string]interface{})
- func AddJSON(key, jsonString string) error
- func ClearAll()
- func ClearAllData()
- func CreateImport(path string, pathToAdd string) error
- func CreateMirror(path string)
- func ExecPathFile(waitGroup *sync.WaitGroup, useWaitGroup bool, template configure.RunConfig, ...) int
- func ExecuteScriptLine(ShellToUse string, cmdArg []string, command string, callback func(string) bool, ...) (int, int, error)
- func ExecuteTemplateWorker(waitGroup *sync.WaitGroup, useWaitGroup bool, target string, ...)
- func FindTemplate() (string, bool)
- func GetData(key string) (bool, map[string]interface{})
- func GetDataKeys() []string
- func GetJSONPathResult(key, path string) (gjson.Result, bool)
- func GetJSONPathValueString(key, path string) string
- func GetLogger() *logrus.Logger
- func GetPH(key string) string
- func GetParsedTemplateSource(path string) (string, error)
- func GetPwdTemplate(path string) (configure.RunConfig, error)
- func GetTemplate() (configure.RunConfig, string, bool)
- func HandleJSONMap(tmpl string, m map[string]interface{}) (string, error)
- func HandlePlaceHolder(line string) string
- func ImportDataFromJSONFile(key string, filename string) error
- func ImportDataFromYAMLFile(key string, filename string) error
- func ImportFileContent(filename string) (string, error)
- func ImportFolder(path string, templatePath string) (map[string]interface{}, error)
- func ImportFolders(templatePath string, paths ...string) (string, error)
- func ImportJSONFile(fileName string) (map[string]interface{}, error)
- func ImportYAMLFile(filename string) (map[string]interface{}, error)
- func LintOut(leftcnt, rightcnt int, all bool)
- func LoadIncTempalte(path string) (string, bool)
- func MainExecute()
- func MergeVariableMap(mapin map[string]interface{}, maporigin map[string]interface{}) map[string]interface{}
- func ResetAllTaskInfos()
- func RunTargets(targets string)
- func SetPH(key, value string)
- func ShowAsYaml()
- func TaskExists(target string) bool
- func TaskRunning(target string) bool
- func TryParse(script []string, regularScript func(string) (bool, int)) (bool, int, []string)
- func WaitForTasksDone(tasks []string, timeOut, tickTime time.Duration, stillWait func() bool, ...)
- func WriteTemplate()
- func YAMLToMap(source string) (map[string]interface{}, error)
- type TaskDef
Constants ¶
const ( // ExitOk the process was executed without errors ExitOk = 0 // ExitByStopReason the process stopped because of a defined reason ExitByStopReason = 101 // ExitNoCode means there was no code associated ExitNoCode = 102 // ExitCmdError means the execution of the command fails. a error by the command itself ExitCmdError = 103 // ExitByRequirement means a requirement was not fulfills ExitByRequirement = 104 // ExitAlreadyRunning means the task is not started, because it is already created ExitAlreadyRunning = 105 )
const ( // DefaultExecFile is the filename of the script defaut file DefaultExecFile = "/.context.json" // DefaultExecYaml is the default yaml configuration file DefaultExecYaml = "/.contxt.yml" // TargetScript is script default target TargetScript = "script" // InitScript is script default target InitScript = "init" // ClearScript is script default target ClearScript = "clear" // TestScript is teh test target TestScript = "test" // DefaultCommandFallBack is used if no command is defined DefaultCommandFallBack = "bash" )
Variables ¶
This section is empty.
Functions ¶
func CreateImport ¶
CreateImport creates import settings
func ExecPathFile ¶
func ExecPathFile(waitGroup *sync.WaitGroup, useWaitGroup bool, template configure.RunConfig, target string) int
ExecPathFile executes the default exec file
func ExecuteScriptLine ¶
func ExecuteScriptLine(ShellToUse string, cmdArg []string, command string, callback func(string) bool, startInfo func(*os.Process)) (int, int, error)
ExecuteScriptLine executes a simple shell script
func ExecuteTemplateWorker ¶
func ExecuteTemplateWorker(waitGroup *sync.WaitGroup, useWaitGroup bool, target string, template configure.RunConfig)
ExecuteTemplateWorker runs ExecCurrentPathTemplate in context of a waitgroup
func FindTemplate ¶
FindTemplate searchs for Template files in different spaces
func GetJSONPathResult ¶
GetJSONPathResult returns the value depending key and path as string
func GetJSONPathValueString ¶
GetJSONPathValueString returns the value depending key and path as string
func GetParsedTemplateSource ¶
GetParsedTemplateSource Returns the soucecode of the template including parsing placeholders
func GetPwdTemplate ¶
GetPwdTemplate returns the template path if exists. it also parses the content of the template against imports and handles them
func GetTemplate ¶
GetTemplate return current template
func HandleJSONMap ¶
HandleJSONMap parsing json content for text/template
func HandlePlaceHolder ¶
HandlePlaceHolder replaces all defined placeholders
func ImportDataFromJSONFile ¶
ImportDataFromJSONFile imports a map from a json file and assign it to a key
func ImportDataFromYAMLFile ¶
ImportDataFromYAMLFile imports a map from a json file and assign it to a key
func ImportFileContent ¶
ImportFileContent imports a file and returns content as string
func ImportFolder ¶
ImportFolder reads folder recusiv and reads all .json, .yml and .yaml files
func ImportFolders ¶
ImportFolders import a list of folders recusiv
func ImportJSONFile ¶
ImportJSONFile imports a json file for reading
func ImportYAMLFile ¶
ImportYAMLFile imports a yaml file as used for json map
func LintOut ¶
LintOut prints the source code and the parsed content in a table view, and marks configured and not configured entries with dfferent colors
func LoadIncTempalte ¶
LoadIncTempalte check if .inc.contxt.yml files exists and if this is the case the content will be loaded and all defined paths used to get values for parsing the template file
func MergeVariableMap ¶
func MergeVariableMap(mapin map[string]interface{}, maporigin map[string]interface{}) map[string]interface{}
MergeVariableMap merges two maps
func TaskRunning ¶
TaskRunning checks if a task is already running
func WaitForTasksDone ¶
func WaitForTasksDone(tasks []string, timeOut, tickTime time.Duration, stillWait func() bool, isDone func(), timeOutHandle func(), notStartet func(string) bool)
WaitForTasksDone waits until all the task are done triggers a callback for any tick and one if the state DONE is reached there is an timeout as maximum time to wait if this time is reached the process will be continued and the timeout callback is triggered the callback for notStarted must return true if they handle this issue. on returning false it will be counted as isDone