MCPcopy Index your code
hub / github.com/jetify-com/devbox / CreateFilesForConfig

Method CreateFilesForConfig

internal/plugin/plugin.go:73–109  ·  view source on GitHub ↗
(cfg *Config)

Source from the content-addressed store, hash-verified

71}
72
73func (m *Manager) CreateFilesForConfig(cfg *Config) error {
74 virtenvPath := filepath.Join(m.ProjectDir(), VirtenvPath)
75 pkg := cfg.Source
76 locked := m.lockfile.Packages[pkg.LockfileKey()]
77
78 name := pkg.CanonicalName()
79
80 // Always create this dir because some plugins depend on it.
81 if err := createDir(filepath.Join(virtenvPath, name)); err != nil {
82 return err
83 }
84
85 slog.Debug("creating files for package", "pkg", pkg)
86 for filePath, contentPath := range cfg.CreateFiles {
87 if !m.shouldCreateFile(locked, filePath) {
88 continue
89 }
90
91 dirPath := filepath.Dir(filePath)
92 if contentPath == "" {
93 dirPath = filePath
94 }
95 if err := createDir(dirPath); err != nil {
96 return errors.WithStack(err)
97 }
98
99 if contentPath == "" {
100 continue
101 }
102
103 if err := m.createFile(pkg, filePath, contentPath, virtenvPath); err != nil {
104 return err
105 }
106 }
107
108 return nil
109}
110
111func (m *Manager) UpdateLockfileVersion(cfg *Config) error {
112 pkg := cfg.Source

Callers 2

newFlakePlanFunction · 0.80
installPackagesMethod · 0.80

Calls 6

shouldCreateFileMethod · 0.95
createFileMethod · 0.95
createDirFunction · 0.85
ProjectDirMethod · 0.65
LockfileKeyMethod · 0.65
CanonicalNameMethod · 0.65

Tested by

no test coverage detected