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 := plugin.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 IsCompatibleLanguagePluginInstalled(name string) bool { jsonFilePath, err := plugin.GetLanguageJSONFilePath(name) if err != nil { return false } r, err := getRunnerJSONContents(jsonFilePath) if err != nil { return false } return (version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport) == nil) }
func getLanguageJSONFilePath(manifest *manifest.Manifest, r *Runner) (string, error) { languageJSONFilePath, err := plugin.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 := plugin.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 := plugin.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 }