updated static file

This commit is contained in:
Stephen McQuay 2015-04-29 23:46:13 -07:00
parent 9b635031a4
commit 0d11e37ebd
1 changed files with 288 additions and 0 deletions

288
static.go Normal file
View File

@ -0,0 +1,288 @@
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"strings"
"os"
"time"
"io/ioutil"
"path"
"path/filepath"
)
func bindata_read(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)
gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
return buf.Bytes(), nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindata_file_info struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindata_file_info) Name() string {
return fi.name
}
func (fi bindata_file_info) Size() int64 {
return fi.size
}
func (fi bindata_file_info) Mode() os.FileMode {
return fi.mode
}
func (fi bindata_file_info) ModTime() time.Time {
return fi.modTime
}
func (fi bindata_file_info) IsDir() bool {
return false
}
func (fi bindata_file_info) Sys() interface{} {
return nil
}
var _templates_base_txt = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x54\x8d\x4d\x0a\x82\x31\x0c\x44\xf7\xdf\x29\x86\x1c\xa0\x47\xf1\x0e\x95\x4c\xb1\xd0\x1f\x91\x6c\xa4\xf4\xee\xa6\x76\x61\xdd\x0d\xbc\x97\x97\x31\x00\x65\xca\x8d\x90\x07\xa3\xf2\x25\x98\x73\x2d\x38\x32\xd6\x67\x89\xe6\xcc\xb2\x15\x0a\xc2\x2d\x56\xba\xe0\x8c\x4d\x7d\x5c\x67\x20\xf5\x6e\x3b\xb0\xd6\x0a\xe4\x84\xb0\xf5\x70\x5e\xe1\xef\xfe\xf7\xe5\xde\xf5\x2d\x5f\xf5\xfa\x04\x00\x00\xff\xff\x3a\xe8\x5b\x9b\x99\x00\x00\x00")
func templates_base_txt_bytes() ([]byte, error) {
return bindata_read(
_templates_base_txt,
"templates/base.txt",
)
}
func templates_base_txt() (*asset, error) {
bytes, err := templates_base_txt_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "templates/base.txt", size: 153, mode: os.FileMode(436), modTime: time.Unix(1430376012, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templates_body_txt = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x54\x8e\x3d\xae\xc2\x30\x10\x84\xfb\x9c\x62\xe4\xe6\x75\x39\xc0\xeb\xb8\x00\x15\x17\x30\xda\x09\xb1\xe4\xc4\x28\xde\x26\x0a\xbe\x3b\xbb\x06\x09\xe8\xec\xf9\xf9\x76\x8e\x03\xc2\x29\xad\x44\xb8\x16\xd9\x03\x5a\x1b\x4c\x53\x2e\xf7\x1c\xd5\xd4\x99\x51\xb8\x05\x8c\xee\x78\xe4\x1f\xe6\x8f\xe7\xb8\x10\x78\x40\x93\x66\xb6\x86\x54\xbb\x7c\xba\xd1\x72\xd8\x19\xb7\x8a\x92\xe5\x97\x35\x95\xa2\x9d\xd5\xdb\xaf\x4b\x5c\xc5\x5f\xc3\xd7\x90\xce\xf4\x25\xb8\xcc\xc6\x7d\xa3\xed\xff\x57\xe1\x0b\xf0\xa9\x3d\x03\x00\x00\xff\xff\xd5\x37\xef\x52\xbf\x00\x00\x00")
func templates_body_txt_bytes() ([]byte, error) {
return bindata_read(
_templates_body_txt,
"templates/body.txt",
)
}
func templates_body_txt() (*asset, error) {
bytes, err := templates_body_txt_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "templates/body.txt", size: 191, mode: os.FileMode(436), modTime: time.Unix(1430376238, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templates_detail_txt = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x64\x8d\x41\x0a\xc2\x40\x0c\x45\xf7\x3d\xc5\x67\x36\xee\x7a\x14\x57\x5e\x20\x75\x52\x3a\x30\x9d\x88\xf3\xbb\x90\xd2\xbb\x9b\xa0\xa0\x50\xc8\x22\x79\x9f\x97\xbf\xef\xc8\x3a\x97\xa6\x48\x93\xe5\x57\xc2\x71\x0c\xce\xa8\xeb\xa3\x0a\x9d\x2e\x2a\x59\x9f\x09\x63\x24\xcd\x20\x77\x6e\x52\x5d\xa2\x94\xda\x21\x93\x6d\x84\x1b\xe3\x55\x56\x3d\xd9\xb3\x19\xc3\xfe\x70\x6d\x39\xb6\xe1\xaf\x94\x85\x55\x23\xc7\x6d\x29\x1d\x3e\xf1\xcb\xef\x4b\xff\x76\xe0\x27\xbe\x03\x00\x00\xff\xff\x3a\x2e\xd6\x82\xad\x00\x00\x00")
func templates_detail_txt_bytes() ([]byte, error) {
return bindata_read(
_templates_detail_txt,
"templates/detail.txt",
)
}
func templates_detail_txt() (*asset, error) {
bytes, err := templates_detail_txt_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "templates/detail.txt", size: 173, mode: os.FileMode(436), modTime: time.Unix(1430376284, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templates_pic_txt = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x54\x8e\x31\x0e\xc2\x30\x0c\x45\xf7\x9e\xe2\x2b\x0b\x5b\x0f\xc0\xc6\x05\x98\xb8\x40\xc0\xbf\x34\x52\xda\x54\x8d\x97\xaa\xe4\xee\x38\x01\x09\xba\x25\xff\xd9\xef\x7b\xdf\x21\x1c\xc2\x4c\xb8\x7b\x92\xcd\xa1\x94\xce\x32\xe5\xb4\x44\xaf\x96\x8e\xf4\xc2\xd5\xa1\xaf\x64\x09\x8f\x33\x0c\xf7\x57\x3f\x11\x78\x41\x83\x46\x96\x82\x90\x5b\x7c\x79\xd2\xc6\xb0\xd1\xaf\x19\x29\xca\x51\x35\xa4\xa4\x55\xf5\xa9\xe0\x2c\xf5\xd5\xfd\x5d\xd0\x6c\x95\xe3\x36\x9a\xf1\x2b\xb5\xff\x29\xc3\xaa\xf1\xdb\x7a\x07\x00\x00\xff\xff\x4a\xaa\xab\xd4\xb7\x00\x00\x00")
func templates_pic_txt_bytes() ([]byte, error) {
return bindata_read(
_templates_pic_txt,
"templates/pic.txt",
)
}
func templates_pic_txt() (*asset, error) {
bytes, err := templates_pic_txt_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "templates/pic.txt", size: 183, mode: os.FileMode(436), modTime: time.Unix(1430376250, 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)
}
// 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){
"templates/base.txt": templates_base_txt,
"templates/body.txt": templates_body_txt,
"templates/detail.txt": templates_detail_txt,
"templates/pic.txt": templates_pic_txt,
}
// 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 name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() (*asset, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"templates": &_bintree_t{nil, map[string]*_bintree_t{
"base.txt": &_bintree_t{templates_base_txt, map[string]*_bintree_t{
}},
"body.txt": &_bintree_t{templates_body_txt, map[string]*_bintree_t{
}},
"detail.txt": &_bintree_t{templates_detail_txt, map[string]*_bintree_t{
}},
"pic.txt": &_bintree_t{templates_pic_txt, map[string]*_bintree_t{
}},
}},
}}
// Restore 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, path.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
}
// Restore assets under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
return RestoreAsset(dir, name)
} else { // Dir
for _, child := range children {
err = RestoreAssets(dir, path.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, "/")...)...)
}