Documentation
¶
Overview ¶
Package project provides project-related utilities and configuration handling
Index ¶
- Constants
- func FindProjectsDown(startPath string, dirCallback func(path string, d fs.DirEntry) error) error
- func FindProjectsUp(startPath string) ([]string, error)
- func GetConfigPath(configName string) (string, error)
- func GetDistributions(projectPath string) ([]string, error)
- func GetProjectRoot() (string, error)
- func IsDivekitProject(path string) bool
- func ScriptDir(projectPath string) string
- func UpdateProjectInIndex(ctx context.Context, store index.Store, path string) error
- type Error
- func NewAbsolutePathGetError(path string, err error) *Error
- func NewDistributionsUpdateError(absPath string, err error) *Error
- func NewError(errorType ErrorType, message string, err error) *Error
- func NewIndexStoreNotInitializedError() *Error
- func NewProjectIndexAddError(absPath string, err error) *Error
- func NewProjectNotFoundError() *Error
- type ErrorType
Constants ¶
const ( MsgAbsolutePathGetFailed = "could not get absolute path" MsgProjectIndexAddFailed = "failed to add project to index" MsgDistributionsUpdateFailed = "failed to update distributions for project" MsgProjectNotFound = "not a divekit project (or any of the parent directories)" MsgIndexStoreNotInitialized = "project index store is not initialized" )
Standardized error messages as constants
Variables ¶
This section is empty.
Functions ¶
func FindProjectsDown ¶
FindProjectsDown wraps filepath.WalkDir to process directories. The dirCallback is called for each directory found. The callback can return filepath.SkipDir to prevent descending into a directory.
func FindProjectsUp ¶
FindProjectsUp searches for directories containing a .divekit folder, starting from startPath and moving up to the root directory. It returns a slice of absolute paths to the found project directories.
func GetConfigPath ¶
GetConfigPath returns the absolute path to the Divekit configuration file resolved relative to the project root.
func GetDistributions ¶
GetDistributions reads the names of the distributions from the project's .divekit directory.
func GetProjectRoot ¶
GetProjectRoot traverses up from the current working directory to find the project root. The project root is identified by the presence of a .divekit directory. Returns the absolute path to the project root or an error if no divekit project is found.
func IsDivekitProject ¶
IsDivekitProject checks if the given path contains a divekit project by verifying the existence of a .divekit directory. This directory serves as the marker for divekit-managed repositories.
Types ¶
type Error ¶
type Error struct {
apperror.Carrier
ErrorType ErrorType
Message string
Err error // Wrapped error
}
Error represents a specific error in the project package
func NewAbsolutePathGetError ¶
NewAbsolutePathGetError creates a new error for absolute path retrieval failures
func NewDistributionsUpdateError ¶
NewDistributionsUpdateError creates a new error for distributions update failures
func NewIndexStoreNotInitializedError ¶
func NewIndexStoreNotInitializedError() *Error
NewIndexStoreNotInitializedError creates a new error when the index store is not initialized
func NewProjectIndexAddError ¶
NewProjectIndexAddError creates a new error for project index addition failures
func NewProjectNotFoundError ¶
func NewProjectNotFoundError() *Error
NewProjectNotFoundError creates a new error when a divekit project cannot be found