Skip to content

Commit

Permalink
Merge pull request #128 from ninech/ruby-lang
Browse files Browse the repository at this point in the history
feat: add experimental ruby-heroku language
  • Loading branch information
ctrox authored Jul 17, 2024
2 parents 5e194ee + 7f14705 commit b715b9f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion create/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type applicationCmd struct {
GitInformationServiceURL string `help:"URL of the git information service." default:"https://git-info.deplo.io" env:"GIT_INFORMATION_SERVICE_URL" hidden:""`
SkipRepoAccessCheck bool `help:"Skip the git repository access check" default:"false"`
Debug bool `help:"Enable debug messages" default:"false"`
Language string `help:"Language specifies which language your app is. If left empty, deploio will detect the language automatically. ${enum}" enum:"ruby,php,python,golang,nodejs,static," default:""`
Language string `help:"${app_language_help} Possible values: ${enum}" enum:"ruby,php,python,golang,nodejs,static,ruby-heroku," default:""`
}

type gitConfig struct {
Expand Down Expand Up @@ -569,5 +569,8 @@ func ApplicationKongVars() (kong.Vars, error) {

result["app_default_deploy_job_timeout"] = "5m"
result["app_default_deploy_job_retries"] = "3"
result["app_language_help"] = "Language specifies which language your app is. " +
"If left empty, deploio will detect the language automatically. " +
"Note that *-heroku languages are experimental and may be removed in future releases."
return result, nil
}
2 changes: 1 addition & 1 deletion get/all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dev pear Release apps.nine.ch
objects: []client.Object{testApplication("banana", "dev"), testRelease("pear", "dev")},
outputFormat: yamlOut,
projectName: "dev",
output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n defaultHosts: null\n image: {}\nstatus:\n atProvider: {}\n",
output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n dockerfileBuild:\n enabled: false\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n defaultHosts: null\n image: {}\nstatus:\n atProvider: {}\n",
},
"all projects, full format": {
projects: test.Projects(organization, "dev", "staging", "prod"),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/moby v26.0.0+incompatible
github.com/moby/term v0.5.0
github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6
github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72
github.com/posener/complete v1.2.3
github.com/prometheus/common v0.52.2
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6 h1:pLpF8VsnBVqovY3wGxU8LQO8scEn32Lsc9zoqRY3jbs=
github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6/go.mod h1:6lFCwHqvcTFZvJ6zY0rxaPIoKc0CX9sHhtH/nyo/5is=
github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72 h1:K0GFWZERwXe35L7SZpHRja8PmufQ3L121rmINRioZ+I=
github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72/go.mod h1:6lFCwHqvcTFZvJ6zY0rxaPIoKc0CX9sHhtH/nyo/5is=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
Expand Down
2 changes: 1 addition & 1 deletion update/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type applicationCmd struct {
GitInformationServiceURL string `help:"URL of the git information service." default:"https://git-info.deplo.io" env:"GIT_INFORMATION_SERVICE_URL" hidden:""`
SkipRepoAccessCheck bool `help:"Skip the git repository access check" default:"false"`
Debug bool `help:"Enable debug messages" default:"false"`
Language *string `help:"Language specifies which language your app is. If left empty, deploio will detect the language automatically. ${enum}" enum:"ruby,php,python,golang,nodejs,static," default:""`
Language *string `help:"${app_language_help} Possible values: ${enum}" enum:"ruby,php,python,golang,nodejs,static,ruby-heroku," default:""`
}

type gitConfig struct {
Expand Down
7 changes: 5 additions & 2 deletions update/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
apps "github.com/ninech/apis/apps/v1alpha1"
"github.com/ninech/nctl/api"
"github.com/ninech/nctl/api/util"
"github.com/ninech/nctl/create"
"github.com/ninech/nctl/internal/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -523,15 +524,17 @@ func TestApplication(t *testing.T) {
// want to test it in case this ever changes in future kong versions.
func TestApplicationFlags(t *testing.T) {
nilFlags := &applicationCmd{}
_, err := kong.Must(nilFlags).Parse([]string{`testname`})
vars, err := create.ApplicationKongVars()
require.NoError(t, err)
_, err = kong.Must(nilFlags, vars).Parse([]string{`testname`})
require.NoError(t, err)

assert.Nil(t, nilFlags.Hosts)
assert.Nil(t, nilFlags.Env)
assert.Nil(t, nilFlags.BuildEnv)

emptyFlags := &applicationCmd{}
_, err = kong.Must(emptyFlags).Parse([]string{`testname`, `--hosts=""`, `--env=`, `--build-env=`})
_, err = kong.Must(emptyFlags, vars).Parse([]string{`testname`, `--hosts=""`, `--env=`, `--build-env=`})
require.NoError(t, err)

assert.NotNil(t, emptyFlags.Hosts)
Expand Down

0 comments on commit b715b9f

Please sign in to comment.