Skip to content

Commit

Permalink
Merge branch 'dev' into core-clean
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Nov 6, 2024
2 parents 7423eb3 + 3029fdc commit ee721f0
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
11 changes: 6 additions & 5 deletions artifactory/utils/commandsummary/markdownConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions common/commands/configfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions common/project/projectconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
Dotnet
Build
Terraform
Cocoapods
)

type ConfigType string
Expand All @@ -62,6 +63,7 @@ var ProjectTypes = []string{
"dotnet",
"build",
"terraform",
"cocoapods",
}

func (projectType ProjectType) String() string {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
14 changes: 8 additions & 6 deletions plugins/components/conversionlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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
Expand Down
10 changes: 2 additions & 8 deletions plugins/components/conversionlayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down Expand Up @@ -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"),
),
Expand All @@ -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
},
}

Expand Down

0 comments on commit ee721f0

Please sign in to comment.