1
0
Fork 0
mirror of https://github.com/Luzifer/git-changerelease.git synced 2024-12-20 19:11:17 +00:00
git-changerelease/assets.go

261 lines
7.3 KiB
Go
Raw Normal View History

2016-07-14 10:55:04 +00:00
// Code generated by go-bindata.
// sources:
// assets/git_changerelease.yaml
// assets/log_template.md
// DO NOT EDIT!
package main
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 _assetsGit_changereleaseYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\xca\x31\xae\xc2\x30\x0c\x87\xf1\xdd\xa7\xb0\xb2\xe7\x1d\xa0\xe3\x1b\x38\x02\x0b\x2a\x91\xdb\xfe\x1b\x0c\x4d\x1b\xd9\x19\x90\xaa\xde\x1d\x21\x01\xcb\xb7\xfc\xbe\x18\x23\x4d\xea\x32\x2c\x48\xae\x79\xc5\x94\x9a\x64\xef\x78\x96\xc5\x41\x54\xa4\x8d\xb7\x54\xdf\xed\x88\x39\x72\xb8\x5e\xe6\x53\xaf\xcf\xf0\xb5\x22\xf7\xcd\x7e\xf6\x3f\xf4\x06\x79\xe8\x9a\x03\x91\x61\x81\x38\xd2\xb8\x95\xa2\x2d\x15\xb8\x4b\x46\xc7\xa1\x1a\xaa\x18\xf8\x33\xf0\xbe\xff\x9d\x61\xae\xdb\x7a\x1c\x81\x5e\x01\x00\x00\xff\xff\x16\x79\xcd\x39\x94\x00\x00\x00")
2016-07-14 10:55:04 +00:00
func assetsGit_changereleaseYamlBytes() ([]byte, error) {
return bindataRead(
_assetsGit_changereleaseYaml,
"assets/git_changerelease.yaml",
)
}
func assetsGit_changereleaseYaml() (*asset, error) {
bytes, err := assetsGit_changereleaseYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "assets/git_changerelease.yaml", size: 148, mode: os.FileMode(436), modTime: time.Unix(1494239100, 0)}
2016-07-14 10:55:04 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _assetsLog_templateMd = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x52\x56\xa8\xae\x56\xd0\xf3\x4b\xad\x28\x09\x4b\x2d\x2a\xce\xcc\xcf\x53\xa8\xad\x55\xd0\x87\x08\xe6\x97\xeb\xb9\xe5\x17\xe5\x26\x96\x28\x28\x19\x19\x18\x98\xe9\x1a\x18\xea\x1a\x18\x29\x29\xd4\xd6\x72\x55\x57\x2b\x14\x25\xe6\xa5\xa7\x2a\xa8\xe4\x64\xe6\xa5\x2a\x58\xd9\x2a\xe8\xf9\xe4\xa7\xfb\x64\xe6\xa5\x16\x83\xa4\x15\x14\xb4\x40\x26\x80\x25\xf5\x82\x4b\x93\xb2\x52\x93\x4b\x20\xda\x74\x15\x52\xf3\x52\x40\x4c\x90\x11\x7a\xfe\x39\x29\x3e\xf9\xe9\x20\x2e\x20\x00\x00\xff\xff\x04\x83\xa4\x75\x87\x00\x00\x00")
2016-07-14 10:55:04 +00:00
func assetsLog_templateMdBytes() ([]byte, error) {
return bindataRead(
_assetsLog_templateMd,
"assets/log_template.md",
)
}
func assetsLog_templateMd() (*asset, error) {
bytes, err := assetsLog_templateMdBytes()
if err != nil {
return nil, err
}
2016-07-14 12:22:26 +00:00
info := bindataFileInfo{name: "assets/log_template.md", size: 135, mode: os.FileMode(436), modTime: time.Unix(1468497058, 0)}
2016-07-14 10:55:04 +00:00
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){
"assets/git_changerelease.yaml": assetsGit_changereleaseYaml,
"assets/log_template.md": assetsLog_templateMd,
}
// 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{
"assets": &bintree{nil, map[string]*bintree{
"git_changerelease.yaml": &bintree{assetsGit_changereleaseYaml, map[string]*bintree{}},
"log_template.md": &bintree{assetsLog_templateMd, 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, "/")...)...)
}