Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 50c7fd1

Browse files
authored
Merge pull request #26 from mnottale/disable-init-service-query
Disable init request for service list.
2 parents 4b10033 + dc40120 commit 50c7fd1

File tree

4 files changed

+2
-151
lines changed

4 files changed

+2
-151
lines changed

packager/init.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,7 @@ func Init(name string, composeFiles []string) error {
4242

4343
func initFromScratch(name string) error {
4444
log.Println("init from scratch")
45-
fmt.Println(`
46-
Please indicate a list of services that will be used by your application, one per line.
47-
Examples of possible values: java, mysql, redis, ruby, postgres, rabbitmq...`)
48-
services, err := utils.ReadNewlineSeparatedList(os.Stdin)
49-
if err != nil {
50-
return err
51-
}
52-
composeData, err := composeFileFromScratch(services)
45+
composeData, err := composeFileFromScratch()
5346
if err != nil {
5447
return err
5548
}
@@ -75,15 +68,8 @@ func initFromComposeFiles(name string, composeFiles []string, merger ComposeConf
7568
return utils.CreateFileWithData(path.Join(dirName, "settings.yml"), []byte{'\n'})
7669
}
7770

78-
func composeFileFromScratch(services []string) ([]byte, error) {
71+
func composeFileFromScratch() ([]byte, error) {
7972
fileStruct := types.NewInitialComposeFile()
80-
serviceMap := *fileStruct.Services
81-
for _, svc := range services {
82-
svcData := utils.MatchService(svc)
83-
serviceMap[svcData.ServiceName] = types.InitialService{
84-
Image: svcData.ServiceImage,
85-
}
86-
}
8773
return yaml.Marshal(fileStruct)
8874
}
8975

packager/init_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/gotestyourself/gotestyourself/assert"
1111
"github.com/gotestyourself/gotestyourself/fs"
1212

13-
"github.com/docker/lunchbox/types"
1413
"github.com/docker/lunchbox/utils"
1514
yaml "gopkg.in/yaml.v2"
1615
)
@@ -45,25 +44,6 @@ func (m *DummyConfigMerger) MergeComposeConfig(composeFiles []string) ([]byte, e
4544
return []byte(dummyComposeData), nil
4645
}
4746

48-
func TestComposeFileFromScratch(t *testing.T) {
49-
services := []string{
50-
"redis", "mysql", "python",
51-
}
52-
53-
result, err := composeFileFromScratch(services)
54-
assert.NilError(t, err)
55-
56-
expected := types.NewInitialComposeFile()
57-
expected.Services = &map[string]types.InitialService{
58-
"redis": {Image: "redis"},
59-
"mysql": {Image: "mysql"},
60-
"python": {Image: "python"},
61-
}
62-
expectedBytes, err := yaml.Marshal(expected)
63-
assert.NilError(t, err)
64-
assert.DeepEqual(t, result, expectedBytes)
65-
}
66-
6747
func TestInitFromComposeFiles(t *testing.T) {
6848
testAppName := randomName("app_")
6949
merger := NewDummyConfigMerger()

utils/components.go

Lines changed: 0 additions & 80 deletions
This file was deleted.

utils/components_test.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)