noodle

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package noodle helps embedding static assets into go binary, it supports using ignore file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanLine

func CleanLine(line string) string

CleanLine remove trailing space and \n, and anything following #

func GenerateEmbed

func GenerateEmbed(root string) ([]byte, error)

GenerateEmbed return code without package and the CODE GENERATED header

func LineToPattern

func LineToPattern(line string) fsutil.IgnorePattern

func ReadIgnore

func ReadIgnore(reader io.Reader) (*fsutil.Ignores, error)

ReadIgnore reads ignore file and change to patterns reading is based on https://github.com/codeskyblue/dockerignore/blob/HEAD/ignore.go#L40

func ReadIgnoreFile

func ReadIgnoreFile(path string) (*fsutil.Ignores, error)

func RegisterEmbedBox

func RegisterEmbedBox(name string, box EmbedBox)

Types

type EmbedBox

type EmbedBox struct {
	Dirs map[string]EmbedDir
	Data []byte
	// contains filtered or unexported fields
}

func GetEmbedBox

func GetEmbedBox(name string) (EmbedBox, error)

func (*EmbedBox) ExtractFiles

func (b *EmbedBox) ExtractFiles() error

func (*EmbedBox) Open

func (b *EmbedBox) Open(name string) (http.File, error)

type EmbedDir

type EmbedDir struct {
	FileInfo
	Entries []FileInfo
}

func (*EmbedDir) Close

func (d *EmbedDir) Close() error

func (*EmbedDir) Read

func (d *EmbedDir) Read(p []byte) (int, error)

func (*EmbedDir) Readdir

func (d *EmbedDir) Readdir(count int) ([]os.FileInfo, error)

func (*EmbedDir) Seek

func (d *EmbedDir) Seek(offset int64, whence int) (int64, error)

func (*EmbedDir) Stat

func (d *EmbedDir) Stat() (os.FileInfo, error)

type EmbedFile

type EmbedFile struct {
	FileInfo
	Data []byte
	// contains filtered or unexported fields
}

func (*EmbedFile) Close

func (f *EmbedFile) Close() error

func (*EmbedFile) Read

func (f *EmbedFile) Read(p []byte) (int, error)

func (*EmbedFile) Readdir

func (f *EmbedFile) Readdir(count int) ([]os.FileInfo, error)

func (*EmbedFile) Seek

func (f *EmbedFile) Seek(offset int64, whence int) (int64, error)

func (*EmbedFile) Stat

func (f *EmbedFile) Stat() (os.FileInfo, error)

type FileInfo

type FileInfo struct {
	FileName    string
	FileSize    int64
	FileMode    os.FileMode
	FileModTime time.Time
	FileIsDir   bool
}

the awkward File* prefix is to export the field but avoid conflict with os.FileInfo interface ...

func NewFileInfo

func NewFileInfo(info os.FileInfo) *FileInfo

func (*FileInfo) IsDir

func (i *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (i *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (i *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (i *FileInfo) Name() string

func (*FileInfo) Size

func (i *FileInfo) Size() int64

func (*FileInfo) Sys

func (i *FileInfo) Sys() interface{}

type LocalFs

type LocalFs struct {
	// contains filtered or unexported fields
}

func NewLocal

func NewLocal(root string) *LocalFs

NewLocal returns a http.FileSystem using local directory, list directory is disabled, it's just a wrap around http.Dir

func NewLocalUnsafe

func NewLocalUnsafe(root string) *LocalFs

NewLocalUnsafe allows list directory and use http.Dir directly

func (*LocalFs) Open

func (fs *LocalFs) Open(name string) (http.File, error)

Directories

Path Synopsis
_examples
embed command
embed/gen
Code generated by gommon from config/gommon.yml DO NOT EDIT.
Code generated by gommon from config/gommon.yml DO NOT EDIT.
embed_by_hand command
local command

Jump to

Keyboard shortcuts

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