MCPcopy Index your code
hub / github.com/devspace-sh/devspace / initDevspace

Method initDevspace

cmd/init.go:176–548  ·  view source on GitHub ↗
(f factory.Factory, configLoader loader.ConfigLoader)

Source from the content-addressed store, hash-verified

174}
175
176func (cmd *InitCmd) initDevspace(f factory.Factory, configLoader loader.ConfigLoader) error {
177 // Create new dockerfile generator
178 languageHandler, err := generator.NewLanguageHandler("", "", cmd.log)
179 if err != nil {
180 return err
181 }
182
183 err = languageHandler.CopyTemplates(".", false)
184 if err != nil {
185 return err
186 }
187
188 startScriptAbsPath, err := filepath.Abs(startScriptName)
189 if err != nil {
190 return err
191 }
192
193 _, err = os.Stat(startScriptAbsPath)
194 if err == nil {
195 // Ensure file is executable
196 err = os.Chmod(startScriptAbsPath, 0755)
197 if err != nil {
198 return err
199 }
200 }
201
202 var config *latest.Config
203
204 // create kubectl client
205 client, err := f.NewKubeClientFromContext(cmd.GlobalFlags.KubeContext, cmd.GlobalFlags.Namespace)
206 if err == nil {
207 configInterface, err := configLoader.Load(context.TODO(), client, &loader.ConfigOptions{}, cmd.log)
208 if err == nil {
209 config = configInterface.Config()
210 }
211 }
212
213 localCache, err := localcache.NewCacheLoader().Load(constants.DefaultConfigPath)
214 if err != nil {
215 return err
216 }
217
218 if config == nil {
219 // Create config
220 config = latest.New().(*latest.Config)
221 if err != nil {
222 return err
223 }
224 }
225
226 // Create ConfigureManager
227 configureManager := f.NewConfigureManager(config, localCache, cmd.log)
228
229 // Determine name for this devspace project
230 projectName, projectNamespace, err := getProjectName()
231 if err != nil {
232 return err
233 }

Callers 1

RunMethod · 0.95

Calls 15

CopyTemplatesMethod · 0.95
renderMethod · 0.95
addDevConfigMethod · 0.95
NewLanguageHandlerFunction · 0.92
NewCacheLoaderFunction · 0.92
NewFunction · 0.92
GetPortsFunction · 0.92
SaveFunction · 0.92
ConfigPathFunction · 0.92
getProjectNameFunction · 0.85
parseImagesFunction · 0.85

Tested by

no test coverage detected