project

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2024 License: Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMonoTag

func IsMonoTag(tag string) bool

isMonoTag returns true if the tag is a monorepo tag.

Types

type DefaultProjectLoader

type DefaultProjectLoader struct {
	// contains filtered or unexported fields
}

DefaultProjectLoader is the default implementation of the ProjectLoader.

func NewCustomProjectLoader

func NewCustomProjectLoader(
	fs afero.Fs,
	bl loader.BlueprintLoader,
	rl git.RepoLoader,
	runtimes []RuntimeData,
	logger *slog.Logger,
) DefaultProjectLoader

NewCustomProjectLoader creates a new DefaultProjectLoader with custom dependencies.

func NewDefaultProjectLoader

func NewDefaultProjectLoader(
	ci, local bool,
	runtimes []RuntimeData,
	logger *slog.Logger,
) DefaultProjectLoader

NewDefaultProjectLoader creates a new DefaultProjectLoader.

func (*DefaultProjectLoader) Load

func (p *DefaultProjectLoader) Load(projectPath string) (Project, error)

type GitRuntime

type GitRuntime struct {
	// contains filtered or unexported fields
}

GitRuntime is a runtime data loader for git related data.

func NewGitRuntime

func NewGitRuntime(logger *slog.Logger) *GitRuntime

NewGitRuntime creates a new GitRuntime.

func (*GitRuntime) Load

func (g *GitRuntime) Load(project *Project) map[string]string

type MonoTag

type MonoTag struct {
	Project string
	Tag     string
}

MonoTag represents a monorepo tag.

func ParseMonoTag

func ParseMonoTag(tag string) MonoTag

parseMonoTag parses a monorepo tag into its project and tag components.

type Project

type Project struct {
	Blueprint schema.Blueprint
	CI        bool
	Earthfile *earthfile.Earthfile
	Local     bool
	Name      string
	Path      string
	Repo      *gg.Repository
	RepoRoot  string
	Tags      TagInfo
	// contains filtered or unexported fields
}

Project represents a project

func (*Project) GetRelativePath

func (p *Project) GetRelativePath() (string, error)

GetRelativePath returns the relative path of the project from the repo root.

func (*Project) Raw

func (p *Project) Raw() blueprint.RawBlueprint

Raw returns the raw blueprint.

func (*Project) RunTarget

RunTarget runs the given Earthly target.

type ProjectLoader

type ProjectLoader interface {
	// Load loads the project.
	Load(projectPath string) (Project, error)
}

ProjectLoader is an interface for loading projects.

type RuntimeData

type RuntimeData interface {
	Load(project *Project) map[string]string
}

RuntimeData is an interface for runtime data loaders.

func GetDefaultRuntimes

func GetDefaultRuntimes(logger *slog.Logger) []RuntimeData

GetDefaultRuntimes returns the default runtime data loaders.

type TagInfo

type TagInfo struct {
	Generated string `json:"generated"`
	Git       string `json:"git"`
}

type Tagger

type Tagger struct {
	// contains filtered or unexported fields
}

Tagger parses tag information from projects.

func NewTagger

func NewTagger(p *Project, ci bool, trim bool, logger *slog.Logger) *Tagger

NewTagger creates a new tagger for the given project.

func (*Tagger) GenerateTag

func (t *Tagger) GenerateTag() (string, error)

GenerateTag generates a tag for the project based on the tagging strategy.

func (*Tagger) GetGitTag

func (t *Tagger) GetGitTag() (string, error)

GetGitTag returns the git tag of the project. If the project is a monorepo, the tag is parsed and the project path is trimmed if necessary. If the project is not a monorepo, the tag is returned as is. If no git tag exists, or the project path does not match the monorepo tag, an empty string is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL