git-project-manager/internal/projects/projects_fs.go

31 lines
628 B
Go
Raw Normal View History

2023-12-09 04:13:17 +00:00
package projects
import (
"os"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/gitlab"
)
func (c *Cache) GoTo(project *gitlab.Project) {
pPath := c.path + "/" + project.SanitizedPath()
c.log.Debug("Going to project", c.log.Args(
"project", project.String(),
"path", pPath,
))
if _, err := os.Stat(pPath); err != nil {
c.log.Info("Preparing project path")
c.PrepProjectPath(pPath)
}
}
func (c *Cache) PrepProjectPath(path string) {
if err := os.MkdirAll(path, 0750); err != nil {
c.log.Fatal("Failed to prepare project path", c.log.Args(
"path", path,
"error", err,
))
}
}