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
Knut Ahlers 0fd766218d
refactor code, follow linter advices
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-07-03 09:46:37 +02:00

312 lines
8 KiB
Go

// Code generated by go-bindata. DO NOT EDIT.
// sources:
// assets/git_changerelease.yaml
// assets/log_template.md
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 fileInfoEx
}
type fileInfoEx interface {
os.FileInfo
MD5Checksum() string
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
md5checksum string
}
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) MD5Checksum() string {
return fi.md5checksum
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _bindataAssetsGitchangereleaseyaml = []byte(
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\xca\x31\x0e\x82\x40\x10\x46\xe1\x7e\x4e\x31\xd9\x7e\xf7\x00\x94\x16" +
"\x1e\xc1\xc6\xe0\x66\x80\x9f\x75\x94\x05\x32\x43\x61\x42\xb8\xbb\x31\x51\x9b\xd7\x7c\x2f\xc6\x48\x34\xa8\x4b\x37" +
"\x21\xbb\x96\x19\x43\xde\xa4\x78\xc3\xa3\x4c\x0e\xa2\x2a\x5b\x7f\xcf\xeb\xa7\x0d\x31\x47\x0e\xb7\xeb\x78\x6e\xf5" +
"\x15\x7e\x56\xe5\xb1\xd8\xdf\x4e\x5d\x6b\x90\xa7\xce\x25\x10\x19\x26\x88\x23\xf7\x4b\xad\xba\xe5\x0a\x77\x29\x68" +
"\x38\xac\x86\x55\x0c\xfc\x1d\x78\xdf\xd3\x05\xe6\xba\xcc\xc7\x11\x88\x52\x4a\xf4\x0e\x00\x00\xff\xff\x04\x87\x72" +
"\xbd\x9a\x00\x00\x00")
func bindataAssetsGitchangereleaseyamlBytes() ([]byte, error) {
return bindataRead(
_bindataAssetsGitchangereleaseyaml,
"assets/git_changerelease.yaml",
)
}
func bindataAssetsGitchangereleaseyaml() (*asset, error) {
bytes, err := bindataAssetsGitchangereleaseyamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{
name: "assets/git_changerelease.yaml",
size: 154,
md5checksum: "",
mode: os.FileMode(436),
modTime: time.Unix(1530601676, 0),
}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _bindataAssetsLogtemplatemd = []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")
func bindataAssetsLogtemplatemdBytes() ([]byte, error) {
return bindataRead(
_bindataAssetsLogtemplatemd,
"assets/log_template.md",
)
}
func bindataAssetsLogtemplatemd() (*asset, error) {
bytes, err := bindataAssetsLogtemplatemdBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{
name: "assets/log_template.md",
size: 135,
md5checksum: "",
mode: os.FileMode(436),
modTime: time.Unix(1468497058, 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, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
//
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
// nolint: deadcode
//
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, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
//
// AssetNames returns the names of the assets.
// nolint: deadcode
//
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": bindataAssetsGitchangereleaseyaml,
"assets/log_template.md": bindataAssetsLogtemplatemd,
}
//
// 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, &os.PathError{
Op: "open",
Path: name,
Err: os.ErrNotExist,
}
}
}
}
if node.Func != nil {
return nil, &os.PathError{
Op: "open",
Path: name,
Err: os.ErrNotExist,
}
}
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{Func: nil, Children: map[string]*bintree{
"assets": {Func: nil, Children: map[string]*bintree{
"git_changerelease.yaml": {Func: bindataAssetsGitchangereleaseyaml, Children: map[string]*bintree{}},
"log_template.md": {Func: bindataAssetsLogtemplatemd, Children: 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
}
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
}
// 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, "/")...)...)
}