MCPcopy Index your code
hub / github.com/celer-pkg/celer / write

Method write

configs/install_report.go:250–279  ·  view source on GitHub ↗
(p *Port)

Source from the content-addressed store, hash-verified

248}
249
250func (i *installReport) write(p *Port) (string, error) {
251 if i == nil || p == nil {
252 return "", nil
253 }
254
255 var statisticDir string
256 if p.DevDep || p.HostDep {
257 hostName := p.ctx.Platform().GetHostName()
258 statisticDir = filepath.Join(dirs.InstalledDir, "celer", "statistics", hostName+"-dev")
259 } else {
260 projectName := p.ctx.Project().GetName()
261 platformName := p.ctx.Platform().GetName()
262 buildType := p.ctx.BuildType()
263 statisticDir = filepath.Join(dirs.InstalledDir, "celer", "statistics", platformName, projectName, buildType)
264 }
265 if err := fileio.MkdirAll(statisticDir, os.ModePerm); err != nil {
266 return "", err
267 }
268
269 fileBase := strings.ReplaceAll(i.rootPort, "@", "_")
270 mdPath := filepath.Join(statisticDir, fileBase+".md")
271
272 // Generate markdown report.
273 markdown := i.renderMarkdown(p)
274 if err := os.WriteFile(mdPath, []byte(markdown), os.ModePerm); err != nil {
275 return "", err
276 }
277
278 return mdPath, nil
279}

Callers 1

InstallMethod · 0.80

Calls 8

renderMarkdownMethod · 0.95
MkdirAllFunction · 0.92
WriteFileMethod · 0.80
GetHostNameMethod · 0.65
PlatformMethod · 0.65
GetNameMethod · 0.65
ProjectMethod · 0.65
BuildTypeMethod · 0.65

Tested by

no test coverage detected