Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion common/commands/configfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
21 changes: 20 additions & 1 deletion common/commands/configfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions common/project/projectconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
Podman
Twine
Helm
Ruby
)

type ConfigType string
Expand Down Expand Up @@ -75,6 +76,7 @@ var ProjectTypes = []string{
"podman",
"twine",
"helm",
"ruby",
}

func (projectType ProjectType) String() string {
Expand Down
4 changes: 3 additions & 1 deletion common/project/projectconfig_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package project

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestFromString(t *testing.T) {
Expand All @@ -15,6 +16,7 @@ func TestFromString(t *testing.T) {
{"pip", Pip},
{"npm", Npm},
{"pnpm", Pnpm},
{"ruby", Ruby},
}

for _, testCase := range testCases {
Expand Down
Loading