aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2017-05-20 15:43:42 -0700
committerChristine Dodrill <me@christine.website>2017-05-20 15:43:42 -0700
commit9cbb20aea2d6b1979a47af9956dbcc8dbe2a2e08 (patch)
tree9d3b8a93d647484a490b1db5907d7b87b85081a9 /vendor/github.com
parentd9e24cd8978458ee72c98ad0c13316907517e499 (diff)
downloadxesite-9cbb20aea2d6b1979a47af9956dbcc8dbe2a2e08.tar.xz
xesite-9cbb20aea2d6b1979a47af9956dbcc8dbe2a2e08.zip
add vendor dependencies
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/GeertJohan/go.rice/appended.go138
-rw-r--r--vendor/github.com/GeertJohan/go.rice/box.go337
-rw-r--r--vendor/github.com/GeertJohan/go.rice/config.go39
-rw-r--r--vendor/github.com/GeertJohan/go.rice/debug.go4
-rw-r--r--vendor/github.com/GeertJohan/go.rice/embedded.go90
-rw-r--r--vendor/github.com/GeertJohan/go.rice/embedded/embedded.go80
-rw-r--r--vendor/github.com/GeertJohan/go.rice/file.go144
-rw-r--r--vendor/github.com/GeertJohan/go.rice/http.go21
-rw-r--r--vendor/github.com/GeertJohan/go.rice/sort.go19
-rw-r--r--vendor/github.com/GeertJohan/go.rice/virtual.go252
-rw-r--r--vendor/github.com/GeertJohan/go.rice/walk.go122
-rw-r--r--vendor/github.com/Xe/gopreload/doc.go7
-rw-r--r--vendor/github.com/Xe/gopreload/preload.go26
-rw-r--r--vendor/github.com/Xe/jsonfeed/jsonfeed.go242
-rw-r--r--vendor/github.com/Xe/ln/filter.go66
-rw-r--r--vendor/github.com/Xe/ln/formatter.go110
-rw-r--r--vendor/github.com/Xe/ln/logger.go141
-rw-r--r--vendor/github.com/Xe/ln/stack.go44
-rw-r--r--vendor/github.com/daaku/go.zipexe/zipexe.go142
-rw-r--r--vendor/github.com/google/gops/agent/agent.go237
-rw-r--r--vendor/github.com/google/gops/internal/internal.go52
-rw-r--r--vendor/github.com/google/gops/signal/signal.go35
-rw-r--r--vendor/github.com/gorilla/feeds/atom.go163
-rw-r--r--vendor/github.com/gorilla/feeds/doc.go70
-rw-r--r--vendor/github.com/gorilla/feeds/feed.go106
-rw-r--r--vendor/github.com/gorilla/feeds/rss.go146
-rw-r--r--vendor/github.com/gorilla/feeds/uuid.go27
-rw-r--r--vendor/github.com/kardianos/osext/osext.go33
-rw-r--r--vendor/github.com/kardianos/osext/osext_plan9.go20
-rw-r--r--vendor/github.com/kardianos/osext/osext_procfs.go36
-rw-r--r--vendor/github.com/kardianos/osext/osext_sysctl.go126
-rw-r--r--vendor/github.com/kardianos/osext/osext_windows.go34
-rw-r--r--vendor/github.com/pkg/errors/errors.go269
-rw-r--r--vendor/github.com/pkg/errors/stack.go178
-rw-r--r--vendor/github.com/russross/blackfriday/block.go1450
-rw-r--r--vendor/github.com/russross/blackfriday/doc.go32
-rw-r--r--vendor/github.com/russross/blackfriday/html.go949
-rw-r--r--vendor/github.com/russross/blackfriday/inline.go1152
-rw-r--r--vendor/github.com/russross/blackfriday/latex.go332
-rw-r--r--vendor/github.com/russross/blackfriday/markdown.go924
-rw-r--r--vendor/github.com/russross/blackfriday/smartypants.go400
-rw-r--r--vendor/github.com/tj/front/front.go24
42 files changed, 8819 insertions, 0 deletions
diff --git a/vendor/github.com/GeertJohan/go.rice/appended.go b/vendor/github.com/GeertJohan/go.rice/appended.go
new file mode 100644
index 0000000..a986a0c
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/appended.go
@@ -0,0 +1,138 @@
+package rice
+
+import (
+ "archive/zip"
+ "log"
+ "os"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/daaku/go.zipexe"
+ "github.com/kardianos/osext"
+)
+
+// appendedBox defines an appended box
+type appendedBox struct {
+ Name string // box name
+ Files map[string]*appendedFile // appended files (*zip.File) by full path
+}
+
+type appendedFile struct {
+ zipFile *zip.File
+ dir bool
+ dirInfo *appendedDirInfo
+ children []*appendedFile
+ content []byte
+}
+
+// appendedBoxes is a public register of appendes boxes
+var appendedBoxes = make(map[string]*appendedBox)
+
+func init() {
+ // find if exec is appended
+ thisFile, err := osext.Executable()
+ if err != nil {
+ return // not appended or cant find self executable
+ }
+ closer, rd, err := zipexe.OpenCloser(thisFile)
+ if err != nil {
+ return // not appended
+ }
+ defer closer.Close()
+
+ for _, f := range rd.File {
+ // get box and file name from f.Name
+ fileParts := strings.SplitN(strings.TrimLeft(filepath.ToSlash(f.Name), "/"), "/", 2)
+ boxName := fileParts[0]
+ var fileName string
+ if len(fileParts) > 1 {
+ fileName = fileParts[1]
+ }
+
+ // find box or create new one if doesn't exist
+ box := appendedBoxes[boxName]
+ if box == nil {
+ box = &appendedBox{
+ Name: boxName,
+ Files: make(map[string]*appendedFile),
+ }
+ appendedBoxes[boxName] = box
+ }
+
+ // create and add file to box
+ af := &appendedFile{
+ zipFile: f,
+ }
+ if f.Comment == "dir" {
+ af.dir = true
+ af.dirInfo = &appendedDirInfo{
+ name: filepath.Base(af.zipFile.Name),
+ //++ TODO: use zip modtime when that is set correctly: af.zipFile.ModTime()
+ time: time.Now(),
+ }
+ } else {
+ // this is a file, we need it's contents so we can create a bytes.Reader when the file is opened
+ // make a new byteslice
+ af.content = make([]byte, af.zipFile.FileInfo().Size())
+ // ignore reading empty files from zip (empty file still is a valid file to be read though!)
+ if len(af.content) > 0 {
+ // open io.ReadCloser
+ rc, err := af.zipFile.Open()
+ if err != nil {
+ af.content = nil // this will cause an error when the file is being opened or seeked (which is good)
+ // TODO: it's quite blunt to just log this stuff. but this is in init, so rice.Debug can't be changed yet..
+ log.Printf("error opening appended file %s: %v", af.zipFile.Name, err)
+ } else {
+ _, err = rc.Read(af.content)
+ rc.Close()
+ if err != nil {
+ af.content = nil // this will cause an error when the file is being opened or seeked (which is good)
+ // TODO: it's quite blunt to just log this stuff. but this is in init, so rice.Debug can't be changed yet..
+ log.Printf("error reading data for appended file %s: %v", af.zipFile.Name, err)
+ }
+ }
+ }
+ }
+
+ // add appendedFile to box file list
+ box.Files[fileName] = af
+
+ // add to parent dir (if any)
+ dirName := filepath.Dir(fileName)
+ if dirName == "." {
+ dirName = ""
+ }
+ if fileName != "" { // don't make box root dir a child of itself
+ if dir := box.Files[dirName]; dir != nil {
+ dir.children = append(dir.children, af)
+ }
+ }
+ }
+}
+
+// implements os.FileInfo.
+// used for Readdir()
+type appendedDirInfo struct {
+ name string
+ time time.Time
+}
+
+func (adi *appendedDirInfo) Name() string {
+ return adi.name
+}
+func (adi *appendedDirInfo) Size() int64 {
+ return 0
+}
+func (adi *appendedDirInfo) Mode() os.FileMode {
+ return os.ModeDir
+}
+func (adi *appendedDirInfo) ModTime() time.Time {
+ return adi.time
+}
+func (adi *appendedDirInfo) IsDir() bool {
+ return true
+}
+func (adi *appendedDirInfo) Sys() interface{} {
+ return nil
+}
diff --git a/vendor/github.com/GeertJohan/go.rice/box.go b/vendor/github.com/GeertJohan/go.rice/box.go
new file mode 100644
index 0000000..71482e2
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/box.go
@@ -0,0 +1,337 @@
+package rice
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "time"
+
+ "github.com/GeertJohan/go.rice/embedded"
+)
+
+// Box abstracts a directory for resources/files.
+// It can either load files from disk, or from embedded code (when `rice --embed` was ran).
+type Box struct {
+ name string
+ absolutePath string
+ embed *embedded.EmbeddedBox
+ appendd *appendedBox
+}
+
+var defaultLocateOrder = []LocateMethod{LocateEmbedded, LocateAppended, LocateFS}
+
+func findBox(name string, order []LocateMethod) (*Box, error) {
+ b := &Box{name: name}
+
+ // no support for absolute paths since gopath can be different on different machines.
+ // therefore, required box must be located relative to package requiring it.
+ if filepath.IsAbs(name) {
+ return nil, errors.New("given name/path is absolute")
+ }
+
+ var err error
+ for _, method := range order {
+ switch method {
+ case LocateEmbedded:
+ if embed := embedded.EmbeddedBoxes[name]; embed != nil {
+ b.embed = embed
+ return b, nil
+ }
+
+ case LocateAppended:
+ appendedBoxName := strings.Replace(name, `/`, `-`, -1)
+ if appendd := appendedBoxes[appendedBoxName]; appendd != nil {
+ b.appendd = appendd
+ return b, nil
+ }
+
+ case LocateFS:
+ // resolve absolute directory path
+ err := b.resolveAbsolutePathFromCaller()
+ if err != nil {
+ continue
+ }
+ // check if absolutePath exists on filesystem
+ info, err := os.Stat(b.absolutePath)
+ if err != nil {
+ continue
+ }
+ // check if absolutePath is actually a directory
+ if !info.IsDir() {
+ err = errors.New("given name/path is not a directory")
+ continue
+ }
+ return b, nil
+ case LocateWorkingDirectory:
+ // resolve absolute directory path
+ err := b.resolveAbsolutePathFromWorkingDirectory()
+ if err != nil {
+ continue
+ }
+ // check if absolutePath exists on filesystem
+ info, err := os.Stat(b.absolutePath)
+ if err != nil {
+ continue
+ }
+ // check if absolutePath is actually a directory
+ if !info.IsDir() {
+ err = errors.New("given name/path is not a directory")
+ continue
+ }
+ return b, nil
+ }
+ }
+
+ if err == nil {
+ err = fmt.Errorf("could not locate box %q", name)
+ }
+
+ return nil, err
+}
+
+// FindBox returns a Box instance for given name.
+// When the given name is a relative path, it's base path will be the calling pkg/cmd's source root.
+// When the given name is absolute, it's absolute. derp.
+// Make sure the path doesn't contain any sensitive information as it might be placed into generated go source (embedded).
+func FindBox(name string) (*Box, error) {
+ return findBox(name, defaultLocateOrder)
+}
+
+// MustFindBox returns a Box instance for given name, like FindBox does.
+// It does not return an error, instead it panics when an error occurs.
+func MustFindBox(name string) *Box {
+ box, err := findBox(name, defaultLocateOrder)
+ if err != nil {
+ panic(err)
+ }
+ return box
+}
+
+// This is injected as a mutable function literal so that we can mock it out in
+// tests and return a fixed test file.
+var resolveAbsolutePathFromCaller = func(name string, nStackFrames int) (string, error) {
+ _, callingGoFile, _, ok := runtime.Caller(nStackFrames)
+ if !ok {
+ return "", errors.New("couldn't find caller on stack")
+ }
+
+ // resolve to proper path
+ pkgDir := filepath.Dir(callingGoFile)
+ // fix for go cover
+ const coverPath = "_test/_obj_test"
+ if !filepath.IsAbs(pkgDir) {
+ if i := strings.Index(pkgDir, coverPath); i >= 0 {
+ pkgDir = pkgDir[:i] + pkgDir[i+len(coverPath):] // remove coverPath
+ pkgDir = filepath.Join(os.Getenv("GOPATH"), "src", pkgDir) // make absolute
+ }
+ }
+ return filepath.Join(pkgDir, name), nil
+}
+
+func (b *Box) resolveAbsolutePathFromCaller() error {
+ path, err := resolveAbsolutePathFromCaller(b.name, 4)
+ if err != nil {
+ return err
+ }
+ b.absolutePath = path
+ return nil
+
+}
+
+func (b *Box) resolveAbsolutePathFromWorkingDirectory() error {
+ path, err := os.Getwd()
+ if err != nil {
+ return err
+ }
+ b.absolutePath = filepath.Join(path, b.name)
+ return nil
+}
+
+// IsEmbedded indicates wether this box was embedded into the application
+func (b *Box) IsEmbedded() bool {
+ return b.embed != nil
+}
+
+// IsAppended indicates wether this box was appended to the application
+func (b *Box) IsAppended() bool {
+ return b.appendd != nil
+}
+
+// Time returns how actual the box is.
+// When the box is embedded, it's value is saved in the embedding code.
+// When the box is live, this methods returns time.Now()
+func (b *Box) Time() time.Time {
+ if b.IsEmbedded() {
+ return b.embed.Time
+ }
+
+ //++ TODO: return time for appended box
+
+ return time.Now()
+}
+
+// Open opens a File from the box
+// If there is an error, it will be of type *os.PathError.
+func (b *Box) Open(name string) (*File, error) {
+ if Debug {
+ fmt.Printf("Open(%s)\n", name)
+ }
+
+ if b.IsEmbedded() {
+ if Debug {
+ fmt.Println("Box is embedded")
+ }
+
+ // trim prefix (paths are relative to box)
+ name = strings.TrimLeft(name, "/")
+ if Debug {
+ fmt.Printf("Trying %s\n", name)
+ }
+
+ // search for file
+ ef := b.embed.Files[name]
+ if ef == nil {
+ if Debug {
+ fmt.Println("Didn't find file in embed")
+ }
+ // file not found, try dir
+ ed := b.embed.Dirs[name]
+ if ed == nil {
+ if Debug {
+ fmt.Println("Didn't find dir in embed")
+ }
+ // dir not found, error out
+ return nil, &os.PathError{
+ Op: "open",
+ Path: name,
+ Err: os.ErrNotExist,
+ }
+ }
+ if Debug {
+ fmt.Println("Found dir. Returning virtual dir")
+ }
+ vd := newVirtualDir(ed)
+ return &File{virtualD: vd}, nil
+ }
+
+ // box is embedded
+ if Debug {
+ fmt.Println("Found file. Returning virtual file")
+ }
+ vf := newVirtualFile(ef)
+ return &File{virtualF: vf}, nil
+ }
+
+ if b.IsAppended() {
+ // trim prefix (paths are relative to box)
+ name = strings.TrimLeft(name, "/")
+
+ // search for file
+ appendedFile := b.appendd.Files[name]
+ if appendedFile == nil {
+ return nil, &os.PathError{
+ Op: "open",
+ Path: name,
+ Err: os.ErrNotExist,
+ }
+ }
+
+ // create new file
+ f := &File{
+ appendedF: appendedFile,
+ }
+
+ // if this file is a directory, we want to be able to read and seek
+ if !appendedFile.dir {
+ // looks like malformed data in zip, error now
+ if appendedFile.content == nil {
+ return nil, &os.PathError{
+ Op: "open",
+ Path: "name",
+ Err: errors.New("error reading data from zip file"),
+ }
+ }
+ // create new bytes.Reader
+ f.appendedFileReader = bytes.NewReader(appendedFile.content)
+ }
+
+ // all done
+ return f, nil
+ }
+
+ // perform os open
+ if Debug {
+ fmt.Printf("Using os.Open(%s)", filepath.Join(b.absolutePath, name))
+ }
+ file, err := os.Open(filepath.Join(b.absolutePath, name))
+ if err != nil {
+ return nil, err
+ }
+ return &File{realF: file}, nil
+}
+
+// Bytes returns the content of the file with given name as []byte.
+func (b *Box) Bytes(name string) ([]byte, error) {
+ file, err := b.Open(name)
+ if err != nil {
+ return nil, err
+ }
+ defer file.Close()
+
+ content, err := ioutil.ReadAll(file)
+ if err != nil {
+ return nil, err
+ }
+
+ return content, nil
+}
+
+// MustBytes returns the content of the file with given name as []byte.
+// panic's on error.
+func (b *Box) MustBytes(name string) []byte {
+ bts, err := b.Bytes(name)
+ if err != nil {
+ panic(err)
+ }
+ return bts
+}
+
+// String returns the content of the file with given name as string.
+func (b *Box) String(name string) (string, error) {
+ // check if box is embedded, optimized fast path
+ if b.IsEmbedded() {
+ // find file in embed
+ ef := b.embed.Files[name]
+ if ef == nil {
+ return "", os.ErrNotExist
+ }
+ // return as string
+ return ef.Content, nil
+ }
+
+ bts, err := b.Bytes(name)
+ if err != nil {
+ return "", err
+ }
+ return string(bts), nil
+}
+
+// MustString returns the content of the file with given name as string.
+// panic's on error.
+func (b *Box) MustString(name string) string {
+ str, err := b.String(name)
+ if err != nil {
+ panic(err)
+ }
+ return str
+}
+
+// Name returns the name of the box
+func (b *Box) Name() string {
+ return b.name
+}
diff --git a/vendor/github.com/GeertJohan/go.rice/config.go b/vendor/github.com/GeertJohan/go.rice/config.go
new file mode 100644
index 0000000..45eb398
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/config.go
@@ -0,0 +1,39 @@
+package rice
+
+// LocateMethod defines how a box is located.
+type LocateMethod int
+
+const (
+ LocateFS = LocateMethod(iota) // Locate on the filesystem according to package path.
+ LocateAppended // Locate boxes appended to the executable.
+ LocateEmbedded // Locate embedded boxes.
+ LocateWorkingDirectory // Locate on the binary working directory
+)
+
+// Config allows customizing the box lookup behavior.
+type Config struct {
+ // LocateOrder defines the priority order that boxes are searched for. By
+ // default, the package global FindBox searches for embedded boxes first,
+ // then appended boxes, and then finally boxes on the filesystem. That
+ // search order may be customized by provided the ordered list here. Leaving
+ // out a particular method will omit that from the search space. For
+ // example, []LocateMethod{LocateEmbedded, LocateAppended} will never search
+ // the filesystem for boxes.
+ LocateOrder []LocateMethod
+}
+
+// FindBox searches for boxes using the LocateOrder of the config.
+func (c *Config) FindBox(boxName string) (*Box, error) {
+ return findBox(boxName, c.LocateOrder)
+}
+
+// MustFindBox searches for boxes using the LocateOrder of the config, like
+// FindBox does. It does not return an error, instead it panics when an error
+// occurs.
+func (c *Config) MustFindBox(boxName string) *Box {
+ box, err := findBox(boxName, c.LocateOrder)
+ if err != nil {
+ panic(err)
+ }
+ return box
+}
diff --git a/vendor/github.com/GeertJohan/go.rice/debug.go b/vendor/github.com/GeertJohan/go.rice/debug.go
new file mode 100644
index 0000000..2e68c84
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/debug.go
@@ -0,0 +1,4 @@
+package rice
+
+// Debug can be set to true to enable debugging.
+var Debug = false
diff --git a/vendor/github.com/GeertJohan/go.rice/embedded.go b/vendor/github.com/GeertJohan/go.rice/embedded.go
new file mode 100644
index 0000000..4f03fe1
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/embedded.go
@@ -0,0 +1,90 @@
+package rice
+
+import (
+ "os"
+ "time"
+
+ "github.com/GeertJohan/go.rice/embedded"
+)
+
+// re-type to make exported methods invisible to user (godoc)
+// they're not required for the user
+// embeddedDirInfo implements os.FileInfo
+type embeddedDirInfo embedded.EmbeddedDir
+
+// Name returns the base name of the directory
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) Name() string {
+ return ed.Filename
+}
+
+// Size always returns 0
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) Size() int64 {
+ return 0
+}
+
+// Mode returns the file mode bits
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) Mode() os.FileMode {
+ return os.FileMode(0555 | os.ModeDir) // dr-xr-xr-x
+}
+
+// ModTime returns the modification time
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) ModTime() time.Time {
+ return ed.DirModTime
+}
+
+// IsDir returns the abbreviation for Mode().IsDir() (always true)
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) IsDir() bool {
+ return true
+}
+
+// Sys returns the underlying data source (always nil)
+// (implementing os.FileInfo)
+func (ed *embeddedDirInfo) Sys() interface{} {
+ return nil
+}
+
+// re-type to make exported methods invisible to user (godoc)
+// they're not required for the user
+// embeddedFileInfo implements os.FileInfo
+type embeddedFileInfo embedded.EmbeddedFile
+
+// Name returns the base name of the file
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) Name() string {
+ return ef.Filename
+}
+
+// Size returns the length in bytes for regular files; system-dependent for others
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) Size() int64 {
+ return int64(len(ef.Content))
+}
+
+// Mode returns the file mode bits
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) Mode() os.FileMode {
+ return os.FileMode(0555) // r-xr-xr-x
+}
+
+// ModTime returns the modification time
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) ModTime() time.Time {
+ return ef.FileModTime
+}
+
+// IsDir returns the abbreviation for Mode().IsDir() (always false)
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) IsDir() bool {
+ return false
+}
+
+// Sys returns the underlying data source (always nil)
+// (implementing os.FileInfo)
+func (ef *embeddedFileInfo) Sys() interface{} {
+ return nil
+}
diff --git a/vendor/github.com/GeertJohan/go.rice/embedded/embedded.go b/vendor/github.com/GeertJohan/go.rice/embedded/embedded.go
new file mode 100644
index 0000000..bba8e58
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/embedded/embedded.go
@@ -0,0 +1,80 @@
+// Package embedded defines embedded data types that are shared between the go.rice package and generated code.
+package embedded
+
+import (
+ "fmt"
+ "path/filepath"
+ "strings"
+ "time"
+)
+
+const (
+ EmbedTypeGo = 0
+ EmbedTypeSyso = 1
+)
+
+// EmbeddedBox defines an embedded box
+type EmbeddedBox struct {
+ Name string // box name
+ Time time.Time // embed time
+ EmbedType int // kind of embedding
+ Files map[string]*EmbeddedFile // ALL embedded files by full path
+ Dirs map[string]*EmbeddedDir // ALL embedded dirs by full path
+}
+
+// Link creates the ChildDirs and ChildFiles links in all EmbeddedDir's
+func (e *EmbeddedBox) Link() {
+ for path, ed := range e.Dirs {
+ fmt.Println(path)
+ ed.ChildDirs = make([]*EmbeddedDir, 0)
+ ed.ChildFiles = make([]*EmbeddedFile, 0)
+ }
+ for path, ed := range e.Dirs {
+ parentDirpath, _ := filepath.Split(path)
+ if strings.HasSuffix(parentDirpath, "/") {
+ parentDirpath = parentDirpath[:len(parentDirpath)-1]
+ }
+ parentDir := e.Dirs[parentDirpath]
+ if parentDir == nil {
+ panic("parentDir `" + parentDirpath + "` is missing in embedded box")
+ }
+ parentDir.ChildDirs = append(parentDir.ChildDirs, ed)
+ }
+ for path, ef := range e.Files {
+ dirpath, _ := filepath.Split(path)
+ if strings.HasSuffix(dirpath, "/") {
+ dirpath = dirpath[:len(dirpath)-1]
+ }
+ dir := e.Dirs[dirpath]
+ if dir == nil {
+ panic("dir `" + dirpath + "` is missing in embedded box")
+ }
+ dir.ChildFiles = append(dir.ChildFiles, ef)
+ }
+}
+
+// EmbeddedDir is instanced in the code generated by the rice tool and contains all necicary information about an embedded file
+type EmbeddedDir struct {
+ Filename string
+ DirModTime time.Time
+ ChildDirs []*EmbeddedDir // direct childs, as returned by virtualDir.Readdir()
+ ChildFiles []*EmbeddedFile // direct childs, as returned by virtualDir.Readdir()
+}
+
+// EmbeddedFile is instanced in the code generated by the rice tool and contains all necicary information about an embedded file
+type EmbeddedFile struct {
+ Filename string // filename
+ FileModTime time.Time
+ Content string
+}
+
+// EmbeddedBoxes is a public register of embedded boxes
+var EmbeddedBoxes = make(map[string]*EmbeddedBox)
+
+// RegisterEmbeddedBox registers an EmbeddedBox
+func RegisterEmbeddedBox(name string, box *EmbeddedBox) {
+ if _, exists := EmbeddedBoxes[name]; exists {
+ panic(fmt.Sprintf("EmbeddedBox with name `%s` exists already", name))
+ }
+ EmbeddedBoxes[name] = box
+}
diff --git a/vendor/github.com/GeertJohan/go.rice/file.go b/vendor/github.com/GeertJohan/go.rice/file.go
new file mode 100644
index 0000000..606a188
--- /dev/null
+++ b/vendor/github.com/GeertJohan/go.rice/file.go
@@ -0,0 +1,144 @@
+package rice
+
+import (
+ "bytes"
+ "errors"
+ "os"
+ "path/filepath"
+)
+
+// File implements the io.Reader, io.Seeker, io.Closer and http.File interfaces
+type File struct {
+ // File abstracts file methods so the user doesn't see the difference between rice.virtualFile, rice.virtualDir and os.File
+ // TODO: maybe use internal File interface and four implementations: *os.File, appendedFile, virtualFile, virtualDir
+
+ // real file on disk
+ realF *os.File
+
+ // when embedded (go)
+ virtualF *virtualFile
+ virtualD *virtualDir
+
+ // when appended (zip)
+ appendedF *appendedFile
+ appendedFileReader *bytes.Reader
+ // TODO: is appendedFileReader subject of races? Might need a lock here..
+}
+
+// Close is like (*os.File).Close()
+// Visit http://golang.org/pkg/os/