diff --git a/artifactory/utils/commandsummary/markdownConfig.go b/artifactory/utils/commandsummary/markdownConfig.go index 300a93d69..d2d8a129b 100644 --- a/artifactory/utils/commandsummary/markdownConfig.go +++ b/artifactory/utils/commandsummary/markdownConfig.go @@ -3,13 +3,14 @@ package commandsummary import ( "encoding/json" "fmt" + "net/http" + "net/url" + "strings" + "github.com/jfrog/jfrog-client-go/http/httpclient" clientUtils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/httputils" - "net/http" - "net/url" - "strings" ) // Static struct to hold the Markdown configuration values @@ -62,7 +63,7 @@ func (mg *MarkdownConfig) SetScanResultsMapping(resultsMap map[string]ScanResult // Initializes the command summary values that effect Markdown generation func InitMarkdownGenerationValues(serverUrl string, platformMajorVersion int) (err error) { - entitled, err := checkExtendedSummaryEntitled(serverUrl) + entitled, err := CheckExtendedSummaryEntitled(serverUrl) if err != nil { return } @@ -72,7 +73,7 @@ func InitMarkdownGenerationValues(serverUrl string, platformMajorVersion int) (e return } -func checkExtendedSummaryEntitled(serverUrl string) (bool, error) { +func CheckExtendedSummaryEntitled(serverUrl string) (bool, error) { // Parse and validate the URL parsedUrl, err := url.Parse(serverUrl) if err != nil || !parsedUrl.IsAbs() { diff --git a/common/commands/configfile.go b/common/commands/configfile.go index f0a7e1ca0..da15c4ed0 100644 --- a/common/commands/configfile.go +++ b/common/commands/configfile.go @@ -171,6 +171,8 @@ func handleInteractiveConfigCreation(configFile *ConfigFile, confType project.Pr return configFile.configGradle() case project.Terraform: return configFile.setDeployer(false) + case project.Cocoapods: + return configFile.setDeployerResolver() } return } diff --git a/common/project/projectconfig.go b/common/project/projectconfig.go index 19422aea6..35cd3ed83 100644 --- a/common/project/projectconfig.go +++ b/common/project/projectconfig.go @@ -39,6 +39,7 @@ const ( Dotnet Build Terraform + Cocoapods ) type ConfigType string @@ -62,6 +63,7 @@ var ProjectTypes = []string{ "dotnet", "build", "terraform", + "cocoapods", } func (projectType ProjectType) String() string { diff --git a/go.mod b/go.mod index 924888d69..1bfb134a3 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/jedib0t/go-pretty/v6 v6.5.9 github.com/jfrog/build-info-go v1.10.3 github.com/jfrog/gofrog v1.7.6 - github.com/jfrog/jfrog-client-go v1.47.3 + github.com/jfrog/jfrog-client-go v1.47.4 github.com/magiconair/properties v1.8.7 github.com/manifoldco/promptui v0.9.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c @@ -96,7 +96,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240918081224-1c584cc334c7 +// replace github.com/jfrog/jfrog-client-go => github.com/eyalbe4/jfrog-client-go v1.28.1-0.20241103083749-45c13ff7fe16 // replace github.com/jfrog/build-info-go => github.com/galusben/build-info-go v0.0.0-20240930113238-ac3b31030284 diff --git a/go.sum b/go.sum index cf59c2400..19c86c5f9 100644 --- a/go.sum +++ b/go.sum @@ -96,8 +96,8 @@ github.com/jfrog/build-info-go v1.10.3 h1:9nqBdZD6xkuxiOvxg+idZ79QLFWQNuucvKkl8X github.com/jfrog/build-info-go v1.10.3/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE= github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s= github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4= -github.com/jfrog/jfrog-client-go v1.47.3 h1:99/JSSgU0rvnM2zWYos2n+Gz1IYLCUoIorE4Xco+Dew= -github.com/jfrog/jfrog-client-go v1.47.3/go.mod h1:NepfaidmK/xiKsVC+0Ur9sANOqL6io8Y7pSaCau7J6o= +github.com/jfrog/jfrog-client-go v1.47.4 h1:4FAuDDvoDRy9LEFe1WwUO5prBXkgyhaWGEZ0vXYL/Z4= +github.com/jfrog/jfrog-client-go v1.47.4/go.mod h1:NepfaidmK/xiKsVC+0Ur9sANOqL6io8Y7pSaCau7J6o= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= diff --git a/plugins/components/conversionlayer.go b/plugins/components/conversionlayer.go index a34da13a5..fe304fb7e 100644 --- a/plugins/components/conversionlayer.go +++ b/plugins/components/conversionlayer.go @@ -7,7 +7,6 @@ import ( "github.com/jfrog/gofrog/datastructures" "github.com/jfrog/jfrog-cli-core/v2/docs/common" - "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/urfave/cli" ) @@ -80,7 +79,7 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) { if err != nil { return cli.Command{}, err } - return cli.Command{ + cliCmd := cli.Command{ Name: cmd.Name, Flags: convertedFlags, Aliases: cmd.Aliases, @@ -93,9 +92,12 @@ func convertCommand(cmd Command, namespaces ...string) (cli.Command, error) { BashComplete: common.CreateBashCompletionFunc(), SkipFlagParsing: cmd.SkipFlagParsing, Hidden: cmd.Hidden, + } + if cmd.Action != nil { // Passing any other interface than 'cli.ActionFunc' will fail the command. - Action: getActionFunc(cmd), - }, nil + cliCmd.Action = getActionFunc(cmd) + } + return cliCmd, nil } func removeEmptyValues(slice []string) []string { @@ -112,8 +114,8 @@ func removeEmptyValues(slice []string) []string { func createCommandUsages(cmd Command, convertedStringFlags map[string]StringFlag, namespaces ...string) (usages []string, err error) { // Handle manual usages provided. if cmd.UsageOptions != nil { - for _, manualUsage := range cmd.UsageOptions.Usage { - usages = append(usages, fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), manualUsage)) + if cmd.UsageOptions.Usage != nil { + usages = append(usages, cmd.UsageOptions.Usage...) } if cmd.UsageOptions.ReplaceAutoGeneratedUsage { return diff --git a/plugins/components/conversionlayer_test.go b/plugins/components/conversionlayer_test.go index 8ad02ece2..58247674d 100644 --- a/plugins/components/conversionlayer_test.go +++ b/plugins/components/conversionlayer_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/stretchr/testify/assert" "github.com/urfave/cli" ) @@ -20,11 +19,6 @@ func TestCreateCommandUsages(t *testing.T) { strFlag := NewStringFlag("flag", "", SetMandatory()) override := []string{"usage override", "usage override 2", "usage override 3"} - expectedOverride := []string{ - fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), "usage override"), - fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), "usage override 2"), - fmt.Sprintf("%s %s", coreutils.GetCliExecutableName(), "usage override 3"), - } tests := []struct { name string @@ -93,7 +87,7 @@ func TestCreateCommandUsages(t *testing.T) { UsageOptions: &UsageOptions{Usage: override}, }, stringFlags: map[string]StringFlag{optStrFlag.Name: optStrFlag}, - expected: append(expectedOverride, + expected: append(override, fmt.Sprintf("%s [command options] <%s> <%s>", expectedPrefix, "first argument", "second"), fmt.Sprintf("%s [command options] --%s=<%s> <%s>", expectedPrefix, optStrFlag.Name, optStrFlag.HelpValue, "first argument"), ), @@ -107,7 +101,7 @@ func TestCreateCommandUsages(t *testing.T) { UsageOptions: &UsageOptions{Usage: override, ReplaceAutoGeneratedUsage: true}, }, stringFlags: map[string]StringFlag{optStrFlag.Name: optStrFlag, strFlag.Name: strFlag}, - expected: expectedOverride, + expected: override, // override is not expected to be changed upon using UsageOptions }, }