@@ -3,6 +3,7 @@ package cmd
33import (
44 "io/ioutil"
55 "os"
6+ "path/filepath"
67 "strconv"
78 "strings"
89
@@ -146,14 +147,14 @@ func (cmd *InitCmd) Run(cobraCmd *cobra.Command, args []string) {
146147 cmd .initChartGenerator ()
147148 cmd .determineLanguage ()
148149 cmd .createChart ()
149- cmd .configureDevSpace ()
150-
151- cmd .config .Image .Name = cmd .config .DevSpace .Release .Name
152150 }
153151
154152 if cmd .flags .reconfigure || ! configExists {
155153 cmd .configureKubernetes ()
156- cmd .configureDevSpaceRelease ()
154+ cmd .configureDevSpace ()
155+
156+ cmd .config .Image .Name = cmd .config .DevSpace .Release .Name
157+
157158 cmd .configureTiller ()
158159 cmd .configureRegistry ()
159160
@@ -183,15 +184,15 @@ func (cmd *InitCmd) initChartGenerator() {
183184}
184185
185186func (cmd * InitCmd ) configureDevSpace () {
186- _ , chartDirNotFound := os .Stat (cmd .chartGenerator . Path + "/chart" )
187+ _ , chartDirNotFound := os .Stat (cmd .workdir + "/chart" )
187188
188189 if chartDirNotFound == nil {
189190 /*TODO
190191 existingChartYaml := map[interface{}]interface{}{}
191192 existingChartValuesYaml := map[interface{}]interface{}{}
192193
193- yamlutil.ReadYamlFromFile(cmd.chartGenerator.Path +"/chart/Chart.yaml", existingChartYaml)
194- yamlutil.ReadYamlFromFile(cmd.chartGenerator.Path +"/chart/values.yaml", existingChartValuesYaml)
194+ yamlutil.ReadYamlFromFile(cmd.workdir +"/chart/Chart.yaml", existingChartYaml)
195+ yamlutil.ReadYamlFromFile(cmd.workdir +"/chart/values.yaml", existingChartValuesYaml)
195196
196197 cmd.config.Release.Name = existingChartYaml["name"].(string)
197198
@@ -212,6 +213,12 @@ func (cmd *InitCmd) configureDevSpace() {
212213 ValidationRegexPattern : v1 .Kubernetes .RegexPatterns .Name ,
213214 })
214215
216+ cmd .config .DevSpace .Release .Namespace = stdinutil .GetFromStdin (& stdinutil.GetFromStdinParams {
217+ Question : "Which Kubernetes namespace should your application run in?" ,
218+ DefaultValue : * cmd .config .DevSpace .Release .Namespace ,
219+ ValidationRegexPattern : v1 .Kubernetes .RegexPatterns .Name ,
220+ })
221+
215222 // cmd.appConfig.Container.Ports, _ = strconv.Atoi(stdinutil.GetFromStdin(&stdinutil.GetFromStdin_params{
216223 // Question: "Which port(s) does your application listen on? (separated by spaces)",
217224 // DefaultValue: strconv.Itoa(cmd.appConfig.Container.Port),
@@ -266,10 +273,11 @@ func (cmd *InitCmd) addPortForwarding(port int) {
266273}
267274
268275func (cmd * InitCmd ) addDefaultSyncConfig () {
269- dockerignore , err := ioutil .ReadFile (cmd .workdir + "/.dockerignore" )
276+ dockerignoreFile := filepath .Join (cmd .workdir , ".dockerignore" )
277+ dockerignore , err := ioutil .ReadFile (dockerignoreFile )
270278 uploadExcludePaths := []string {}
271279
272- if err ! = nil {
280+ if err = = nil {
273281 dockerignoreRules := strings .Split (string (dockerignore ), "\n " )
274282
275283 for _ , ignoreRule := range dockerignoreRules {
@@ -295,14 +303,6 @@ func (cmd *InitCmd) addDefaultSyncConfig() {
295303 cmd .config .DevSpace .Sync = & syncConfig
296304}
297305
298- func (cmd * InitCmd ) configureDevSpaceRelease () {
299- cmd .config .DevSpace .Release .Namespace = stdinutil .GetFromStdin (& stdinutil.GetFromStdinParams {
300- Question : "Which Kubernetes namespace should your application run in?" ,
301- DefaultValue : * cmd .config .DevSpace .Release .Namespace ,
302- ValidationRegexPattern : v1 .Kubernetes .RegexPatterns .Name ,
303- })
304- }
305-
306306func (cmd * InitCmd ) configureTiller () {
307307 tillerConfig := cmd .config .Services .Tiller
308308 tillerRelease := tillerConfig .Release
0 commit comments