Skip to content

Commit b382374

Browse files
authored
added-ruby-to-projects (jfrog#1394)
1 parent a42dfd5 commit b382374

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

common/commands/configfile.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package commands
22

33
import (
44
"fmt"
5-
"github.com/jfrog/jfrog-client-go/artifactory/services"
65
"os"
76
"path/filepath"
87
"strconv"
98
"strings"
109

10+
"github.com/jfrog/jfrog-client-go/artifactory/services"
11+
1112
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
1213
"github.com/jfrog/jfrog-cli-core/v2/common/project"
1314
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
@@ -155,6 +156,8 @@ func handleInteractiveConfigCreation(configFile *ConfigFile, confType project.Pr
155156
return
156157
}
157158
switch confType {
159+
case project.Ruby:
160+
return configFile.setDeployerResolver()
158161
case project.Go:
159162
return configFile.setDeployerResolver()
160163
case project.Pip, project.Pipenv:

common/commands/configfile_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package commands
22

33
import (
44
"flag"
5-
testsutils "github.com/jfrog/jfrog-client-go/utils/tests"
65
"os"
76
"path/filepath"
87
"strings"
98
"testing"
109

10+
testsutils "github.com/jfrog/jfrog-client-go/utils/tests"
11+
1112
"github.com/jfrog/jfrog-cli-core/v2/common/project"
1213
"github.com/jfrog/jfrog-cli-core/v2/common/tests"
1314
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
@@ -158,6 +159,24 @@ func TestNpmConfigFile(t *testing.T) {
158159
assert.Equal(t, "repo-local", config.GetString("deployer.repo"))
159160
}
160161

162+
func TestRubyConfigFile(t *testing.T) {
163+
// Set JFROG_CLI_HOME_DIR environment variable
164+
tempDirPath := createTempEnv(t)
165+
defer testsutils.RemoveAllAndAssert(t, tempDirPath)
166+
167+
// Create build config
168+
context := createContext(t, resolutionServerId+"=relServer", resolutionRepo+"=repo", deploymentServerId+"=depServer", deploymentRepo+"=repo-local")
169+
err := CreateBuildConfig(context, project.Ruby)
170+
assert.NoError(t, err)
171+
172+
// Check configuration
173+
config := checkCommonAndGetConfiguration(t, project.Ruby.String(), tempDirPath)
174+
assert.Equal(t, "relServer", config.GetString("resolver.serverId"))
175+
assert.Equal(t, "repo", config.GetString("resolver.repo"))
176+
assert.Equal(t, "depServer", config.GetString("deployer.serverId"))
177+
assert.Equal(t, "repo-local", config.GetString("deployer.repo"))
178+
}
179+
161180
// In case resolver/deployer server-id flags are not provided - the default configured global server will be chosen.
162181
func TestNpmConfigFileWithDefaultServerId(t *testing.T) {
163182
// Set JFROG_CLI_HOME_DIR environment variable

common/project/projectconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
Podman
4747
Twine
4848
Helm
49+
Ruby
4950
)
5051

5152
type ConfigType string
@@ -75,6 +76,7 @@ var ProjectTypes = []string{
7576
"podman",
7677
"twine",
7778
"helm",
79+
"ruby",
7880
}
7981

8082
func (projectType ProjectType) String() string {

common/project/projectconfig_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package project
22

33
import (
4-
"github.com/stretchr/testify/assert"
54
"testing"
5+
6+
"github.com/stretchr/testify/assert"
67
)
78

89
func TestFromString(t *testing.T) {
@@ -15,6 +16,7 @@ func TestFromString(t *testing.T) {
1516
{"pip", Pip},
1617
{"npm", Npm},
1718
{"pnpm", Pnpm},
19+
{"ruby", Ruby},
1820
}
1921

2022
for _, testCase := range testCases {

0 commit comments

Comments
 (0)