web/static.go

336 lines
32 KiB
Go
Raw Permalink Normal View History

2017-01-26 20:17:35 -08:00
// Code generated by go-bindata.
// sources:
// static/css/sm.css
// static/favicon.ico
// static/img/smcquay.png
// templates/base.html
// templates/home.html
// DO NOT EDIT!
package web
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
func bindataRead(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
clErr := gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _staticCssSmCss = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x50\x5b\x6e\xdb\x30\x10\xfc\xe7\x29\x08\xf8\xc3\x09\x5a\xd9\x8a\x62\x14\x2e\x8d\xa2\x01\x8a\x1c\x84\x26\x57\xf2\xa2\x24\x57\x20\xd7\xa9\xdc\x42\x77\x2f\x14\x51\xaa\xa2\x06\xe1\xe7\x70\x66\xe7\xf1\x84\xbe\xa5\xc8\xf2\x1a\xdd\xdd\x85\xb9\x55\xfb\x7d\x4d\x81\xd3\xae\x21\x6a\x1c\xe8\x16\xd3\xce\x90\xdf\x9b\x94\xbe\xd7\xda\xa3\xbb\x7d\x7b\xee\xe8\x53\xa5\xbe\x96\xe5\xfd\x49\x88\x33\xd9\x9b\xfc\x23\xa4\x94\xf2\xac\xcd\xcf\x26\xd2\x35\xd8\xc2\x90\xa3\xa8\xe4\xa6\xaa\xaa\xd3\xeb\xdf\x04\xd4\x75\x3d\x02\x0c\x1d\x17\xda\x61\x13\x94\x34\x10\x18\xe2\x88\x0f\xe6\xc5\x68\xa4\xe4\xf6\x07\x5d\x23\x42\xdc\x8e\x7f\xad\xb6\x16\x43\xa3\x64\x55\xb6\xdd\x49\xf4\x42\xe8\x6c\x3d\x9f\x3f\x1e\x17\xe7\x2d\x18\x8a\x9a\x91\x82\x92\x81\x02\xbc\x4a\xd4\x0b\x26\x64\xb0\x2b\xa5\x19\x94\xbd\x10\x1b\x43\x81\x21\x70\xfe\x7e\x81\xc8\x68\xb4\x9b\xa2\x7a\xb4\xd6\xc1\xe8\xe1\x75\x6c\x30\x14\x0e\x6a\x56\x52\x5f\x99\xde\xc0\x11\x9b\xcb\x7b\x38\x53\x3b\x15\x98\xfb\x26\xfc\x0d\x8b\x56\x1b\x46\x76\x90\x13\xbc\x1d\xe4\xb9\x23\x59\x6d\x3f\xcb\xa4\x43\x2a\x12\x44\xcc\x73\x7e\x94\x73\x61\x71\x38\x4e\xbe\x79\xcb\xe2\x4c\xcc\xe4\x95\x3c\xcc\xe6\x18\x6a\xca\xde\x13\x69\x91\xb9\x17\xe2\xc9\x83\x45\x2d\xef\x3c\x86\xe2\x17\x5a\xbe\x0c\xea\xb2\xed\xee\xb3\x6a\x35\xe1\xf0\x32\xed\xf1\x38\xf7\x5e\x05\x7b\x98\x83\xf5\x62\x3c\xb2\xdc\x60\x45\xfe\x72\x58\x93\x17\x99\xff\xcb\xfd\x58\xfe\x63\xf7\x42\xec\x18\xc3\xed\xfd\xbb\x0f\xb9\xe1\xdf\x00\x00\x00\xff\xff\x22\x22\xb9\x21\x14\x03\x00\x00")
func staticCssSmCssBytes() ([]byte, error) {
return bindataRead(
_staticCssSmCss,
"static/css/sm.css",
)
}
func staticCssSmCss() (*asset, error) {
bytes, err := staticCssSmCssBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/css/sm.css", size: 788, mode: os.FileMode(436), modTime: time.Unix(1485490593, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _staticFaviconIco = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x62\x60\x60\x64\x60\x64\x10\x10\x00\xd1\x0a\x0c\x19\x2c\x0c\x0c\x62\x0c\x0c\x0c\x1a\x0c\x0c\x0c\x02\x0c\x0c\x0c\x0a\x0c\x10\x71\x5c\xe0\xff\xff\xff\x0c\x21\x7e\x16\xff\xff\x3d\x2c\x23\x09\x83\xf4\x80\xf4\x8e\xea\xa7\x9d\xfe\xf3\xbb\x2b\xff\x1f\xda\x54\x05\x66\xff\xbf\x5f\xfe\xff\xff\x5d\x08\x26\xa4\xff\xff\x83\xca\xff\x25\x3d\x87\xff\xff\xfe\xf3\x1f\x8c\x41\x6c\xb0\x38\x01\xfd\x20\x3b\x60\x66\x2c\x5b\xdc\x09\xd6\x07\xc2\x7d\x33\x97\x41\xe4\x1f\x96\xfe\xff\x7f\xbf\x02\xa7\xfe\xcf\x57\x4b\xfe\xc3\xc0\x89\xcd\x45\xff\xe5\x15\x94\xc1\x18\xc4\x86\x01\x90\x1a\x64\xfd\xd7\x6f\xde\xfd\x0f\xd3\xff\xfc\xe1\xa5\xff\xbf\xff\xfd\xff\x2f\x28\x2c\xfe\x5f\x4f\x47\x1d\xee\x16\xb0\xf8\x1f\x54\x71\x90\x1e\x98\xde\x8a\x0c\x93\xff\x27\x96\xfb\x81\xd5\x81\x00\x36\xfd\xc8\xe2\x20\xb5\xa5\xa9\xe6\x60\xbd\x20\x0c\xe2\xaf\x9a\xe4\x01\x76\xe7\xd7\x6f\xbf\xff\x7f\xff\x05\x71\x3f\x4c\x3f\xb2\xfb\x41\x6c\xb0\xda\xe5\x7e\x28\x6e\xa8\x2e\xf6\x83\x8b\x83\x30\x7a\x5c\x9e\x39\x38\xed\xff\xa9\xfd\xfd\xff\x97\x4e\x0a\x01\xab\x85\xe9\x85\x85\xe1\xc3\x47\x4f\xff\x2f\x98\xd3\x03\x96\x03\xe1\x70\x3f\xc3\xff\x8e\x56\xaa\xff\xfd\x5c\xd5\xff\xa7\x86\xeb\xc2\xc5\x41\x6a\x40\x6a\x61\xfa\x70\xe1\x57\xaf\x3f\xfe\xbf\x73\xff\x31\xd8\x0e\x10\x1b\x97\x3a\x4a\x01\x20\x00\x00\xff\xff\x9f\x48\x88\x13\x7e\x04\x00\x00")
func staticFaviconIcoBytes() ([]byte, error) {
return bindataRead(
_staticFaviconIco,
"static/favicon.ico",
)
}
func staticFaviconIco() (*asset, error) {
bytes, err := staticFaviconIcoBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/favicon.ico", size: 1150, mode: os.FileMode(436), modTime: time.Unix(1456385295, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _staticImgSmcquayPng = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x00\x87\x13\x78\xec\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xfa\x00\xfa\x00\xfa\x1e\xfc\x1e\x87\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdf\x02\x0a\x05\x0d\x2a\x52\x1f\xc2\x2e\x00\x00\x13\x14\x49\x44\x41\x54\x78\xda\xed\x9b\xeb\x93\x55\xd5\x99\xc6\x7f\x6b\xed\xfb\x39\xdd\xf4\x8d\x3b\x2d\x88\xc0\xa8\x88\x77\x0c\x06\x34\xc6\xfb\x04\x31\x26\x15\x75\xca\x64\x9c\xd4\x54\xa5\x92\xf9\x33\x92\xff\x60\x6a\xbe\x65\x32\x35\x49\x39\x26\x93\x49\x70\x32\x63\x89\x49\x50\x93\xa0\x21\x21\x8a\xa8\x20\x46\x89\x42\x83\x34\xd7\xbe\xd1\x87\x73\xd9\x97\xb5\xde\xf9\xb0\xf6\x39\xdd\x20\x12\x71\x34\x6d\xa4\xdf\xaa\xee\xd3\xbd\xcf\xee\x7d\xd6\x7e\xf6\x7b\x79\xde\x67\xbd\x0d\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\x17\x60\xea\x93\xb4\x18\xcf\xf3\x48\x92\x84\x38\x8e\x7f\x12\x86\xe1\x43\x41\x10\x00\x90\x65\x19\x79\x9e\xff\xb4\xd5\x6a\x3d\xdc\x6c\x36\x31\xc6\xcc\x02\xb8\x7c\xf9\x72\x59\xbd\xfa\x4a\x7a\xaa\x31\xa1\x27\x28\x9b\xa3\xb1\xe4\xad\x06\xcd\x46\x9d\x22\xcf\x28\x8a\x1c\x00\x3f\x08\x08\xfc\x90\xa4\x5a\x25\x88\x2a\x88\xf2\xb0\xca\xa7\x55\x08\x93\x8d\x8c\x3d\x7b\x5e\xe7\xd0\xa1\x43\xea\x53\x0f\xe0\xfc\xf9\xf3\xc7\xbe\x70\xcf\x5d\x7d\x5d\x21\x8c\x1e\x1d\xe2\xcd\xd7\x5f\x25\xcf\x52\x50\x67\x2e\x44\x9d\xb5\x42\x25\xef\xbf\xd2\x28\x8e\xb9\x72\xcd\xf5\xf4\x2e\x5c\xc6\xa9\xa6\xe5\xe9\x5f\x3e\xfb\xf2\xc9\x93\x27\xd7\x7e\xaa\x00\x8c\xa2\x88\xaf\x3d\xf2\x77\x12\xda\x3a\x47\x0e\xee\x67\xd1\xe2\x25\x88\x18\x14\x20\xc0\xee\x97\x77\x70\xba\x36\x39\xed\x2f\x04\x55\xa2\xaa\xdc\xaf\xc8\x59\x20\x77\x77\xf7\xb0\xe6\x86\xcf\x00\x0a\xad\x15\x5a\x6b\x8e\x1f\x1d\x66\xc9\xb2\x15\x9c\xb6\x09\xff\xf1\xa3\xff\x52\x59\x96\xfd\xf5\x03\xb8\x74\xe9\x52\xf9\xea\x43\x5f\xe2\xd7\x4f\x3f\xc1\x35\xd7\xdd\xc0\xbb\x43\xef\x70\xf0\x9d\xb7\xd0\x0a\xe2\x38\x24\xf0\x7d\xae\xb9\xf1\xb3\xfc\xe9\xad\x37\x38\x79\xec\x88\x5b\xd4\xb4\x55\xb9\x9f\xdb\x50\xbb\x37\xe6\x2d\x58\xcc\xe2\x4b\x57\xf1\xea\x8b\xbf\x25\x0e\x03\x7c\xdf\x03\x11\x96\x2c\xbb\x8c\x45\x83\xcb\x78\x63\xf7\x2e\x36\xdc\xf3\x15\x7e\xf0\xe3\x9f\x7d\xec\xa1\xfd\xb1\x5e\xfc\x8a\x2b\xae\x90\x7b\x6e\xdf\xc0\xf6\x5f\xfd\x9c\xeb\xae\x5f\xcb\xef\xb6\x3d\x43\x91\x67\x68\xe5\x80\xa9\xc4\x11\x41\xe0\xa3\x15\x5c\xb3\x76\x3d\x2f\xfd\xee\x79\xb2\x2c\x9d\x5a\xd4\x34\xaf\x6b\xc3\x97\x54\xaa\xac\xb8\xfa\x66\x5e\xde\xfe\x1c\xd5\x24\x22\xf0\xfd\xce\x79\x4a\x81\xef\xfb\xdc\x70\xf3\xe7\xd8\xf3\xca\x4b\xac\xfb\xfc\x17\xf8\x9f\x5f\xfe\x96\x3f\xbe\xf9\xa6\xfa\xab\x03\xf0\xaa\xab\xae\x92\x5b\x6e\x5e\xcb\x9b\x7b\x5e\x66\xde\x40\x3f\xbb\x5e\xdc\x8e\x42\x10\x71\x60\x00\xf8\x5a\x51\x89\x43\xe2\x28\xc0\xf7\x34\xab\xae\xba\x9e\x9d\xbf\x7f\x1e\xd5\x81\x6b\x2a\x94\x01\x82\x20\xe0\xaa\xb5\x9f\xe3\xf9\x6d\xbf\xa1\x2b\x82\x24\x8a\x3a\xd7\x6a\x03\xa8\xb5\x42\x03\xab\xaf\xbb\x89\xd1\x91\x13\xfc\xcd\x9a\x1b\xf9\xdf\x67\x77\xf0\xe6\xc7\x04\xa2\xf7\x71\x5c\x74\xdd\xba\x75\x72\xe3\x35\x57\x32\x72\xec\x08\x45\x7a\x9a\xbd\xbb\x77\x01\x60\x04\x0a\x0b\xb9\x11\x32\xe3\x5e\x0b\x63\x08\x3c\x85\xa7\x35\x71\x1c\x63\x8c\xa5\xd9\x6c\x4c\x81\x52\xfe\x14\x84\x01\xf3\x17\x2e\xe1\xd0\xc9\x3a\x79\x6d\x84\x4a\x1c\x01\x90\x66\x39\xad\x34\x23\xcd\x72\x8c\xb5\x28\xa5\x50\x5a\x33\x72\xfc\x08\x7d\xfd\xf3\x30\x45\xc6\x0d\x57\x5f\x49\xae\xa2\x6f\x0f\x0f\x0f\x7f\xe7\xa3\xbe\x57\xff\xa3\xbe\xe0\x5d\x77\xde\x29\x57\xad\x5a\x4a\x6d\x72\x82\x03\x6f\xbd\xc6\xa9\x89\x71\x44\xc0\xd8\x36\x80\x42\x56\x40\x5a\x08\x46\x20\xf1\x05\x48\x19\xe8\xf1\x38\x7c\x70\x3f\x2b\xae\xb8\x9a\x89\xb1\x91\xf7\xc4\x88\xe7\xf9\xc4\x7d\x8b\x39\xfc\xfb\xed\x0c\x74\x05\x80\xa2\xd9\x6c\x51\x58\xe7\xd5\x56\x84\x3c\x2d\x48\x33\x43\x1c\xf9\x24\x51\xc0\xbb\x43\x6f\xd3\xd5\x3d\x87\x39\x73\x7a\xb9\xeb\xe6\x35\x74\x77\x77\xc9\x73\xcf\xfd\x4a\x7d\x62\x3d\xf0\xce\x3b\xef\x94\x4d\xf7\xde\xce\x1b\xaf\xed\x64\xc7\xb6\x67\x69\xb5\x9a\x14\x96\xce\x97\xb5\x0e\xb4\xc2\x40\xb3\x70\xc7\x52\x03\xb9\x15\x22\x2d\xc4
func staticImgSmcquayPngBytes() ([]byte, error) {
return bindataRead(
_staticImgSmcquayPng,
"static/img/smcquay.png",
)
}
func staticImgSmcquayPng() (*asset, error) {
bytes, err := staticImgSmcquayPngBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/img/smcquay.png", size: 4999, mode: os.FileMode(436), modTime: time.Unix(1456385295, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesBaseHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x90\xbf\x4e\xc3\x30\x10\xc6\xf7\x3e\xc5\x71\x33\xad\xc5\x6e\x77\x01\x66\x18\x58\x18\xdd\xf8\xab\x72\xc2\x71\xaa\xf8\xd4\x12\x59\xdd\x10\x12\x4f\x97\x57\x42\xae\x91\xc2\x64\x7f\xf7\xdd\xdf\x5f\x29\x44\x01\x47\x49\x20\x3e\xf8\x0c\xa6\xeb\x75\x63\xef\x9e\x5e\x1e\xdf\xde\x5f\x9f\xa9\xd7\x21\xee\x37\xb6\x3d\x44\x44\xb6\x87\x0f\xed\x7b\x93\x03\xd4\x53\x37\x26\x45\x52\xc7\x17\x09\xda\xbb\x80\xb3\x74\xd8\xde\xc4\x3d\x49\x12\x15\x1f\xb7\xb9\xf3\x11\xee\x81\x29\xf9\x01\x8e\xcf\x82\xcb\x69\x9c\x94\xff\x35\x53\xd1\x88\xfd\xf2\xb3\x7c\x2d\xdf\xd6\x34\xb5\xba\x51\xd2\x07\x4d\x88\x8e\xb3\xce\x11\xb9\x07\x94\x49\xe7\x13\x1c\x2b\x3e\xd5\x74\x39\x33\xf5\x13\x8e\x8e\x4d\x56\xaf\xd2\xd5\x90\xc9\xc3\xae\x3a\x7f\xfb\x9b\xf5\x00\x7b\x18\xc3\xbc\x0e\x28\x85\x14\xc3\x29\x7a\xad\x2c\xc6\x30\x33\xed\x2a\x8d\x56\xd6\x72\xad\x69\x28\x4a\x21\xa4\x50\xdd\xdf\x00\x00\x00\xff\xff\x28\xcf\xe1\x5f\x41\x01\x00\x00")
func templatesBaseHtmlBytes() ([]byte, error) {
return bindataRead(
_templatesBaseHtml,
"templates/base.html",
)
}
func templatesBaseHtml() (*asset, error) {
bytes, err := templatesBaseHtmlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/base.html", size: 321, mode: os.FileMode(436), modTime: time.Unix(1485490572, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesHomeHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x92\xcf\x6a\x84\x30\x10\x87\xef\x7d\x8a\x21\x0f\x90\xdc\x8b\xfa\x06\x7b\x28\x3d\xf5\x98\x26\xa3\x0e\x6c\xfe\xd4\x19\x05\x09\xbe\x7b\xb1\x2b\xa5\xeb\x5a\x58\x73\x4a\xe6\x17\xf2\x7d\x4c\xa6\x14\xf0\xd8\x52\x44\x50\x9f\xc9\xcf\x0a\x96\xe5\x05\xb6\x55\x79\x9a\x80\x7c\xad\x5c\x8a\x82\x51\x54\xf3\x1b\xdd\xc5\x42\x72\xc5\x5d\xf8\x73\xc1\x42\x3f\x60\x5b\xab\x5e\x24\xf3\xab\x31\xac\x83\xfb\x1a\xed\xac\x03\xaa\x86\x6f\xfb\xca\xd8\xdd\xb3\xc6\xd3\xf4\x0f\x29\x93\x3b\xcd\xa9\x28\x74\xc0\x83\xab\x95\x61\xb1\x42\xce\x50\xe8\xcc\x46\xd7\x39\x76\xaa\x39\xe5\x40\xb1\x4d\x47\x12\xf9\xb1\x76\x99\x21\xda\x80\x40\x7c\xef\xb8\x2a\x0a\xe6\x1e\xe3\x5f\xd1\xf7\x5b\x09\x2e\xee\x6d\xeb\x8b\x7e\xa4\x98\x03\x4c\x95\xc1\x5d\x2d\xf3\xfa\x13\x71\x3e\x70\xfb\x48\xe3\x00\x13\x31\x09\x24\xe7\xc6\x01\x3d\x94\x02\x5a\x28\x20\x2c\xcb\x13\x94\x5d\x3f\xb6\x63\x29\x80\xd1\xaf\x13\xf3\x1d\x00\x00\xff\xff\xe4\x0b\xe5\xbd\x46\x02\x00\x00")
func templatesHomeHtmlBytes() ([]byte, error) {
return bindataRead(
_templatesHomeHtml,
"templates/home.html",
)
}
func templatesHomeHtml() (*asset, error) {
bytes, err := templatesHomeHtmlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/home.html", size: 582, mode: os.FileMode(436), modTime: time.Unix(1485490593, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"static/css/sm.css": staticCssSmCss,
"static/favicon.ico": staticFaviconIco,
"static/img/smcquay.png": staticImgSmcquayPng,
"templates/base.html": templatesBaseHtml,
"templates/home.html": templatesHomeHtml,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
rv = append(rv, childName)
}
return rv, nil
}
type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"static": &bintree{nil, map[string]*bintree{
"css": &bintree{nil, map[string]*bintree{
"sm.css": &bintree{staticCssSmCss, map[string]*bintree{}},
}},
"favicon.ico": &bintree{staticFaviconIco, map[string]*bintree{}},
"img": &bintree{nil, map[string]*bintree{
"smcquay.png": &bintree{staticImgSmcquayPng, map[string]*bintree{}},
}},
}},
"templates": &bintree{nil, map[string]*bintree{
"base.html": &bintree{templatesBaseHtml, map[string]*bintree{}},
"home.html": &bintree{templatesHomeHtml, map[string]*bintree{}},
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}