domain

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Target   Target
	Artifact string
}

Artifact is an earthly artifact identifier.

func ParseArtifact

func ParseArtifact(artifactName string) (Artifact, error)

ParseArtifact parses a string representation of an Artifact.

func (Artifact) String

func (ea Artifact) String() string

String returns a string representation of the Artifact.

func (Artifact) StringCanonical

func (ea Artifact) StringCanonical() string

StringCanonical returns a string representation of the Artifact.

type Command added in v0.6.15

type Command struct {
	// Remote representation.
	GitURL string `json:"gitUrl"` // e.g. "github.com/earthly/earthly/examples/go"
	Tag    string `json:"tag"`    // e.g. "main"
	// Local representation. E.g. in "./some/path+something" this is "./some/path".
	LocalPath string `json:"localPath"`
	// Import representation. E.g. in "foo+bar" this is "foo".
	ImportRef string `json:"importRef"`

	// Command name. E.g. in "+SOMETHING" this is "SOMETHING".
	Command string `json:"command"`
}

Command is an earthly command identifier.

func ParseCommand added in v0.6.15

func ParseCommand(fullCommandName string) (Command, error)

ParseCommand parses a string into a Command.

func (Command) DebugString added in v0.6.15

func (ec Command) DebugString() string

DebugString returns a string that can be printed out for debugging purposes

func (Command) GetGitURL added in v0.6.15

func (ec Command) GetGitURL() string

GetGitURL returns the GitURL portion of the command.

func (Command) GetImportRef added in v0.6.15

func (ec Command) GetImportRef() string

GetImportRef returns the ImportRef portion of the command.

func (Command) GetLocalPath added in v0.6.15

func (ec Command) GetLocalPath() string

GetLocalPath returns the Path portion of the command.

func (Command) GetName added in v0.6.15

func (ec Command) GetName() string

GetName returns the Name portion of the command.

func (Command) GetTag added in v0.6.15

func (ec Command) GetTag() string

GetTag returns the Tag portion of the command.

func (Command) IsExternal added in v0.6.15

func (ec Command) IsExternal() bool

IsExternal returns whether the command is external to the current project.

func (Command) IsImportReference added in v0.6.15

func (ec Command) IsImportReference() bool

IsImportReference returns whether the target is a reference to an import.

func (Command) IsLocalExternal added in v0.6.15

func (ec Command) IsLocalExternal() bool

IsLocalExternal returns whether the command is a local, but external command.

func (Command) IsLocalInternal added in v0.6.15

func (ec Command) IsLocalInternal() bool

IsLocalInternal returns whether the command is in the same Earthfile.

func (Command) IsRemote added in v0.6.15

func (ec Command) IsRemote() bool

IsRemote returns whether the command is remote.

func (Command) IsUnresolvedImportReference added in v0.6.15

func (ec Command) IsUnresolvedImportReference() bool

IsUnresolvedImportReference returns whether the command is an import reference that has no remote or local information set.

func (Command) ProjectCanonical added in v0.6.15

func (ec Command) ProjectCanonical() string

ProjectCanonical returns a string representation of the project of the command, in canonical form.

func (Command) String added in v0.6.15

func (ec Command) String() string

String returns a string representation of the command.

func (Command) StringCanonical added in v0.6.15

func (ec Command) StringCanonical() string

StringCanonical returns a string representation of the command, in canonical form.

type ImportTracker added in v0.6.15

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

ImportTracker is a resolver which also takes into account imports.

func NewImportTracker added in v0.6.15

func NewImportTracker(console conslogging.ConsoleLogger, global map[string]ImportTrackerVal) *ImportTracker

NewImportTracker creates a new import resolver.

func (*ImportTracker) Add added in v0.6.15

func (ir *ImportTracker) Add(importStr string, as string, global, currentlyPrivileged, allowPrivilegedFlag bool) error

Add adds an import to the resolver.

func (*ImportTracker) Deref added in v0.6.15

func (ir *ImportTracker) Deref(ref Reference) (resolvedRef Reference, allowPrivileged bool, allowPrivilegedSet bool, err error)

Deref resolves the import (if any) and returns a reference with the full path.

func (*ImportTracker) Global added in v0.6.15

func (ir *ImportTracker) Global() map[string]ImportTrackerVal

Global returns the internal map of global imports.

func (*ImportTracker) SetGlobal added in v0.6.15

func (ir *ImportTracker) SetGlobal(gi map[string]ImportTrackerVal)

SetGlobal sets the global import map.

type ImportTrackerVal added in v0.6.15

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

ImportTrackerVal is used to resolve imports

type Reference added in v0.6.15

type Reference interface {
	// GetGitURL is the git URL part of the reference. E.g. "github.com/earthly/earthly/examples/go"
	GetGitURL() string
	// GetTag is the git tag of the reference. E.g. "main"
	GetTag() string
	// GetLocalPath is the local path representation of the reference. E.g. in "./some/path+something" this is "./some/path".
	GetLocalPath() string
	// GetImportRef is the import identifier. E.g. in "foo+bar" this is "foo".
	GetImportRef() string
	// GetName is the target name or the command name of the reference. E.g. in "+something" this is "something".
	GetName() string

	// IsExternal returns whether the ref is external to the current project.
	IsExternal() bool

	// IsLocalInternal returns whether the ref is a local.
	IsLocalInternal() bool

	// IsLocalExternal returns whether the ref is a local, but external target.
	IsLocalExternal() bool

	// IsRemote returns whether the ref is remote.
	IsRemote() bool

	// IsImportReference returns whether the ref is a reference to an import.
	IsImportReference() bool
	// IsUnresolvedImportReference returns whether the ref is an import reference that has
	// no remote or local information set.
	IsUnresolvedImportReference() bool

	// DebugString returns a string that can be printed out for debugging purposes.
	DebugString() string

	// String returns a string representation of the ref.
	String() string

	// StringCanonical returns a string representation of the ref, in canonical form.
	StringCanonical() string
	// ProjectCanonical returns a string representation of the project of the ref, in canonical form.
	ProjectCanonical() string
}

Reference is a target or a command reference.

func JoinReferences added in v0.6.15

func JoinReferences(r1 Reference, r2 Reference) (Reference, error)

JoinReferences returns the result of interpreting r2 as relative to r1. The result will always have the same type as r2.

type Target

type Target struct {
	// Remote representation.
	GitURL string `json:"gitUrl"` // e.g. "github.com/earthly/earthly/examples/go"
	Tag    string `json:"tag"`    // e.g. "main"
	// Local representation. E.g. in "./some/path+something" this is "./some/path".
	LocalPath string `json:"localPath"`
	// Import representation. E.g. in "foo+bar" this is "foo".
	ImportRef string `json:"importRef"`

	// Target name. E.g. in "+something" this is "something".
	Target string `json:"target"`
}

Target is an earthly target identifier.

func ParseTarget

func ParseTarget(fullTargetName string) (Target, error)

ParseTarget parses a string into a Target.

func (Target) DebugString added in v0.4.0

func (et Target) DebugString() string

DebugString returns a string that can be printed out for debugging purposes

func (Target) GetGitURL added in v0.6.15

func (et Target) GetGitURL() string

GetGitURL returns the GitURL portion of the command.

func (Target) GetImportRef added in v0.6.15

func (et Target) GetImportRef() string

GetImportRef returns the ImportRef portion of the target.

func (Target) GetLocalPath added in v0.6.15

func (et Target) GetLocalPath() string

GetLocalPath returns the Path portion of the target.

func (Target) GetName added in v0.6.15

func (et Target) GetName() string

GetName returns the Name portion of the target.

func (Target) GetTag added in v0.6.15

func (et Target) GetTag() string

GetTag returns the Tag portion of the target.

func (Target) IsExternal

func (et Target) IsExternal() bool

IsExternal returns whether the target is external to the current project.

func (Target) IsImportReference added in v0.6.15

func (et Target) IsImportReference() bool

IsImportReference returns whether the target is a reference to an import.

func (Target) IsLocalExternal

func (et Target) IsLocalExternal() bool

IsLocalExternal returns whether the target is a local, but external target.

func (Target) IsLocalInternal

func (et Target) IsLocalInternal() bool

IsLocalInternal returns whether the target is in the same Earthfile.

func (Target) IsRemote

func (et Target) IsRemote() bool

IsRemote returns whether the target is remote.

func (Target) IsUnresolvedImportReference added in v0.6.15

func (et Target) IsUnresolvedImportReference() bool

IsUnresolvedImportReference returns whether the target is an import reference that has no remote or local information set.

func (Target) ProjectCanonical

func (et Target) ProjectCanonical() string

ProjectCanonical returns a string representation of the project of the target, in canonical form.

func (Target) String

func (et Target) String() string

String returns a string representation of the Target.

func (Target) StringCanonical

func (et Target) StringCanonical() string

StringCanonical returns a string representation of the Target, in canonical form.

Jump to

Keyboard shortcuts

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