diff --git a/common/commands/configfile.go b/common/commands/configfile.go index 637638bd3..a9f45b2a5 100644 --- a/common/commands/configfile.go +++ b/common/commands/configfile.go @@ -2,12 +2,13 @@ package commands import ( "fmt" - "github.com/jfrog/jfrog-client-go/artifactory/services" "os" "path/filepath" "strconv" "strings" + "github.com/jfrog/jfrog-client-go/artifactory/services" + "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -155,6 +156,8 @@ func handleInteractiveConfigCreation(configFile *ConfigFile, confType project.Pr return } switch confType { + case project.Ruby: + return configFile.setDeployerResolver() case project.Go: return configFile.setDeployerResolver() case project.Pip, project.Pipenv: diff --git a/common/commands/configfile_test.go b/common/commands/configfile_test.go index 3485072a5..596292d3e 100644 --- a/common/commands/configfile_test.go +++ b/common/commands/configfile_test.go @@ -2,12 +2,13 @@ package commands import ( "flag" - testsutils "github.com/jfrog/jfrog-client-go/utils/tests" "os" "path/filepath" "strings" "testing" + testsutils "github.com/jfrog/jfrog-client-go/utils/tests" + "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/tests" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" @@ -158,6 +159,24 @@ func TestNpmConfigFile(t *testing.T) { assert.Equal(t, "repo-local", config.GetString("deployer.repo")) } +func TestRubyConfigFile(t *testing.T) { + // Set JFROG_CLI_HOME_DIR environment variable + tempDirPath := createTempEnv(t) + defer testsutils.RemoveAllAndAssert(t, tempDirPath) + + // Create build config + context := createContext(t, resolutionServerId+"=relServer", resolutionRepo+"=repo", deploymentServerId+"=depServer", deploymentRepo+"=repo-local") + err := CreateBuildConfig(context, project.Ruby) + assert.NoError(t, err) + + // Check configuration + config := checkCommonAndGetConfiguration(t, project.Ruby.String(), tempDirPath) + assert.Equal(t, "relServer", config.GetString("resolver.serverId")) + assert.Equal(t, "repo", config.GetString("resolver.repo")) + assert.Equal(t, "depServer", config.GetString("deployer.serverId")) + assert.Equal(t, "repo-local", config.GetString("deployer.repo")) +} + // In case resolver/deployer server-id flags are not provided - the default configured global server will be chosen. func TestNpmConfigFileWithDefaultServerId(t *testing.T) { // Set JFROG_CLI_HOME_DIR environment variable diff --git a/common/project/projectconfig.go b/common/project/projectconfig.go index d8c17fd7b..a4ef3d93e 100644 --- a/common/project/projectconfig.go +++ b/common/project/projectconfig.go @@ -46,6 +46,7 @@ const ( Podman Twine Helm + Ruby ) type ConfigType string @@ -75,6 +76,7 @@ var ProjectTypes = []string{ "podman", "twine", "helm", + "ruby", } func (projectType ProjectType) String() string { diff --git a/common/project/projectconfig_test.go b/common/project/projectconfig_test.go index 9a7edafc5..cdb4126c5 100644 --- a/common/project/projectconfig_test.go +++ b/common/project/projectconfig_test.go @@ -1,8 +1,9 @@ package project import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestFromString(t *testing.T) { @@ -15,6 +16,7 @@ func TestFromString(t *testing.T) { {"pip", Pip}, {"npm", Npm}, {"pnpm", Pnpm}, + {"ruby", Ruby}, } for _, testCase := range testCases {