()
| 868 | } |
| 869 | |
| 870 | func getProjectName() (string, string, error) { |
| 871 | projectName := "" |
| 872 | projectNamespace := "" |
| 873 | gitRemote, err := command.Output(context.TODO(), "", expand.ListEnviron(os.Environ()...), "git", "config", "--get", "remote.origin.url") |
| 874 | if err == nil { |
| 875 | sep := "/" |
| 876 | projectParts := strings.Split(string(regexp.MustCompile(`^.*?://[^/]+?/([^.]+)(\.git)?`).ReplaceAll(gitRemote, []byte("$1"))), sep) |
| 877 | partsLen := len(projectParts) |
| 878 | if partsLen > 1 { |
| 879 | projectNamespace = strings.Join(projectParts[0:partsLen-1], sep) |
| 880 | projectName = projectParts[partsLen-1] |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | if projectName == "" { |
| 885 | absPath, err := filepath.Abs(".") |
| 886 | if err != nil { |
| 887 | return "", "", err |
| 888 | } |
| 889 | projectName = filepath.Base(absPath) |
| 890 | } |
| 891 | |
| 892 | projectName = strings.ToLower(projectName) |
| 893 | projectName = regexp.MustCompile("[^a-zA-Z0-9- ]+").ReplaceAllString(projectName, "") |
| 894 | projectName = regexp.MustCompile("[^a-zA-Z0-9-]+").ReplaceAllString(projectName, "-") |
| 895 | projectName = strings.Trim(projectName, "-") |
| 896 | |
| 897 | if !SpaceNameValidationRegEx.MatchString(projectName) || len(projectName) > 42 { |
| 898 | projectName = "devspace" |
| 899 | } |
| 900 | |
| 901 | return projectName, projectNamespace, nil |
| 902 | } |
| 903 | |
| 904 | func parseImages(manifests string) ([]string, error) { |
| 905 | images := []string{} |
no test coverage detected