stencil

package
v1.39.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stencil provides an entry point for interacting with Stencil.

Index

Examples

Constants

View Source
const (
	// LockfileName is the name of the lockfile used by stencil
	LockfileName = "stencil.lock"
)

This block contains constants of the lockfiles

Variables

This section is empty.

Functions

This section is empty.

Types

type Lockfile

type Lockfile struct {
	// Version correlates to the version of bootstrap
	// that generated this file.
	Version string `yaml:"version"`

	// Modules is a list of modules and their versions that was
	// used the last time stencil was ran.
	// Note: This is only set in stencil.lock
	Modules []*LockfileModuleEntry `yaml:"modules"`

	// Files is a list of files and metadata about them that were
	// generated by stencil
	Files []*LockfileFileEntry `yaml:"files"`
}

Lockfile is generated by stencil on a ran to store version information.

func LoadLockfile

func LoadLockfile(path string) (*Lockfile, error)

LoadLockfile loads a lockfile from a bootstrap repository path

Example
package main

import (
	"fmt"

	"github.com/getoutreach/stencil/pkg/stencil"
)

func main() {
	// Load the lockfile
	l, err := stencil.LoadLockfile("testdata")
	if err != nil {
		// handle the error
		fmt.Println(err)
		return
	}

	fmt.Println(l.Version)

}
Output:

v1.6.2

type LockfileFileEntry added in v1.5.0

type LockfileFileEntry struct {
	// Name is the relative file path, to the invocation of stencil,
	// of the generated file
	Name string

	// Template is the template that generated this file in the given
	// module.
	Template string

	// Module is the URL of the module that generated this file.
	Module string
}

LockfileFileEntry is an entry in the lockfile for a file that was generated by stencil. This contains metadata on what generated it among other future information

type LockfileModuleEntry added in v1.5.0

type LockfileModuleEntry struct {
	// Name is the name of the module. This usually comes from
	// the TemplateManifest entry, but is up to the module
	// package.
	Name string

	// URL is the url of the module that was used.
	URL string

	// Version is the version of the module that was
	// downloaded at the time.
	Version string
}

LockfileModuleEntry is an entry in the lockfile for a module that was used during the last run of stencil.

Jump to

Keyboard shortcuts

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