func ExecuteInitHookForRunner(language string) error { if err := config.SetProjectRoot([]string{}); err != nil { return err } runnerInfo, err := GetRunnerInfo(language) if err != nil { return err } command := []string{} switch runtime.GOOS { case "windows": command = runnerInfo.Init.Windows break case "darwin": command = runnerInfo.Init.Darwin break default: command = runnerInfo.Init.Linux break } languageJsonFilePath, err := common.GetLanguageJSONFilePath(language) runnerDir := filepath.Dir(languageJsonFilePath) cmd, err := common.ExecuteCommand(command, runnerDir, os.Stdout, os.Stderr) if err != nil { return err } return cmd.Wait() }
func getLanguageJSONFilePath(manifest *manifest.Manifest, r *Runner) (string, error) { languageJsonFilePath, err := common.GetLanguageJSONFilePath(manifest.Language) if err != nil { return "", err } contents, err := common.ReadFileContents(languageJsonFilePath) if err != nil { return "", err } err = json.Unmarshal([]byte(contents), r) if err != nil { return "", err } return filepath.Dir(languageJsonFilePath), nil }
func IsCompatibleLanguagePluginInstalled(name string) bool { jsonFilePath, err := common.GetLanguageJSONFilePath(name) if err != nil { return false } var r runner.Runner contents, err := common.ReadFileContents(jsonFilePath) if err != nil { return false } err = json.Unmarshal([]byte(contents), &r) if err != nil { return false } return (version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport) == nil) }
func GetRunnerInfo(language string) (*Runner, error) { runnerInfo := new(Runner) languageJsonFilePath, err := common.GetLanguageJSONFilePath(language) if err != nil { return nil, err } contents, err := common.ReadFileContents(languageJsonFilePath) if err != nil { return nil, err } err = json.Unmarshal([]byte(contents), &runnerInfo) if err != nil { return nil, err } return runnerInfo, nil }