assets

package
v0.0.0-...-c355e20 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFilesRecursively

func LoadFilesRecursively(dir string, predicates ...FileInfoPredicate) (map[string][]byte, error)

LoadFilesRecursively returns a map from relative path names to file content.

func OnlyYaml

func OnlyYaml(info os.FileInfo) bool

OnlyYaml is a predicate for LoadFilesRecursively filters out non-yaml files.

Types

type Asset

type Asset struct {
	Name           string
	FilePermission Permission
	Data           []byte
}

Asset defines a single static asset.

func MustCreateAssetFromTemplate

func MustCreateAssetFromTemplate(name string, template []byte, config interface{}) Asset

MustCreateAssetFromTemplate process the given template using and return an asset.

func (Asset) WriteFile

func (a Asset) WriteFile(path string) error

WriteFile writes a single asset into specified path.

type Assets

type Assets []Asset

Assets is a list of assets.

func New

func New(dir string, data interface{}, predicates ...FileInfoPredicate) (Assets, error)

New walks through a directory recursively and renders each file as asset. Only those files are rendered that make all predicates true.

func (Assets) WriteFiles

func (as Assets) WriteFiles(path string) error

WriteFiles writes the assets to specified path.

type FileInfoPredicate

type FileInfoPredicate func(os.FileInfo) bool

type Permission

type Permission os.FileMode
const (
	PermissionDirectoryDefault Permission = 0755
	PermissionFileDefault      Permission = 0644
	PermissionFileRestricted   Permission = 0600
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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