Documentation ¶
Overview ¶
Package proj contains types and functions for managing a project's Earthfile(s).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = errors.New("proj: this project is not a supported type")
ErrSkip is an error that means that the project should skip this generator.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd interface { // Run is used to run the command. If the command needs to be canceled (or // time out), then ctx should be used to do so. Run(ctx context.Context) (stdout, stderr io.Reader, _ error) }
Cmd represents the type that proj types will use to execute commands.
type FS ¶
FS represents the type that proj types need to inspect files in the filesystem in order to detect what should be in the generated Earthfile(s).
type Golang ¶
type Golang struct {
// contains filtered or unexported fields
}
Golang is used to auto-generate Earthfiles for go projects.
func (*Golang) ForDir ¶
ForDir returns a Project for the given directory. It returns ErrSkip if the directory does not contain a go project.
type Project ¶
type Project interface { // Root returns the root directory for this Project. Root(context.Context) string // Type returns a unique name for this project type. It will be used for // conflict avoidance (i.e. making sure we don't have two go modules loaded) // and as a prefix for targets in multi-project-type Earthfiles. Type(context.Context) string // Targets returns a list of targets for this Project. Targets(ctx context.Context) ([]Target, error) }
Project is a type that can generate Earthfile code for a given project.
type ProjectType ¶
type ProjectType interface { // ForDir returns a Project for the named directory. It should return // ErrSkip if there is no project matching this ProjectType at the requested // dir. ForDir(ctx context.Context, dir string) (Project, error) }
ProjectType represents a type of project (typically a language).
type Target ¶
type Target interface { // SetPrefix sets a prefix to prepend to this target's name. SetPrefix(context.Context, string) // Format writes out the target with the given indentation string and level. Format(ctx context.Context, w io.Writer, indent string, level int) error }
Target is a type that can write a formatted target with a given indent string and indentation level