modules

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package modules implements all logic needed for interacting with stencil modules and their interaction with a service generated by stencil.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {

	// Name is the name of a module. This should be a valid go
	// import path. For example: github.com/getoutreach/stencil-base
	Name string

	// URI is the underlying URI being used to download this module
	URI string

	// Version is the version of this module
	Version string
	// contains filtered or unexported fields
}

Module is a stencil module that contains template files.

func GetModulesForService

func GetModulesForService(ctx context.Context, m *configuration.ServiceManifest) ([]*Module, error)

GetModulesForService returns a list of modules that a given service manifest depends on. They are not returned in the order of their import.

func New

func New(ctx context.Context, name, uri, version string) (*Module, error)

New creates a new module at a specific revision. If a revision is not provided then the latest version is automatically used. A revision must be a valid git ref of semantic version. In the case of a semantic version, a range is also acceptable, e.g. ~1.0.0.

If the uri is a file:// path, a version must be specified otherwise it will be treated as if it has no version. If uri is not specified it is default to HTTPS

func NewWithFS

func NewWithFS(ctx context.Context, name string, fs billy.Filesystem) *Module

NewWithFS creates a module with the specified file system. This is generally only meant to be used in tests.

func (*Module) GetFS

func (m *Module) GetFS(ctx context.Context) (billy.Filesystem, error)

GetFS returns a billy.Filesystem that contains the contents of this module.

func (*Module) GetTemplate

func (m *Module) GetTemplate() *template.Template

GetTemplate returns the go template for this module

func (*Module) Manifest

Manifest downloads the module if not already downloaded and returns a parsed configuration.TemplateRepositoryManifest of this module.

func (*Module) RegisterExtensions

func (m *Module) RegisterExtensions(ctx context.Context, ext *extensions.Host) error

RegisterExtensions registers all extensions provided by the given module. If the module is a local file URI then extensions will be sourced from the `./bin` directory of the base of the path.

Directories

Path Synopsis
Package modulestest contains code for interacting with modules in tests.
Package modulestest contains code for interacting with modules in tests.

Jump to

Keyboard shortcuts

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