ensurefile

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ensurefile assists with loading and representing .ensure.yml files.

Index

Constants

View Source
const ExampleFile = `` /* 785-byte string literal not displayed */

ExampleFile for use in error messages and CLI help menus.

Variables

View Source
var (
	ErrCannotFindGoModule  = erk.New(ErkCannotLoadConfig{}, "Cannot find root go.mod file by searching parent working directories")
	ErrCannotParseGoModule = erk.New(ErkCannotLoadConfig{}, "Cannot read module path from go.mod file: {{.path}}")
	ErrCannotOpenFile      = erk.New(ErkCannotLoadConfig{}, "Cannot open the file '{{.path}}': {{.err}}")
	ErrCannotUnmarshalFile = erk.New(ErkCannotLoadConfig{}, "Cannot parse the file '{{.path}}': {{.err}}")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DisableParallelGeneration bool   `yaml:"-"`
	RootPath                  string `yaml:"-"`
	ModulePath                string `yaml:"-"`

	Mocks *MockConfig `yaml:"mocks"`
}

Config is the root of the .ensure.yml file.

type ErkCannotLoadConfig

type ErkCannotLoadConfig struct{ erk.DefaultKind }

type Loader

type Loader struct {
	FS fs.FS
}

Loader allows loading the project's .ensure.yml file.

func (*Loader) LoadConfig

func (l *Loader) LoadConfig(pwd string) (*Config, error)

LoadConfig from the .ensure.yml file that is located in pwd or a parent of pwd.

type LoaderIface

type LoaderIface interface {
	LoadConfig(pwd string) (*Config, error)
}

type MockConfig

type MockConfig struct {
	PrimaryDestination  string     `yaml:"primaryDestination"`
	InternalDestination string     `yaml:"internalDestination"`
	TidyAfterGenerate   bool       `yaml:"tidyAfterGenerate"`
	Packages            []*Package `yaml:"packages"`
}

type Package

type Package struct {
	Path       string   `yaml:"path"`
	Interfaces []string `yaml:"interfaces"`
}

func (*Package) String added in v0.1.1

func (pkg *Package) String() string

String exposes the Package as `<Path>:<Interfaces[0]>,<Interfaces[1]>,...`.

Jump to

Keyboard shortcuts

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