feat: boot.img.lz4
This commit is contained in:
5
vendor/github.com/gobuffalo/envy/.env
generated
vendored
Normal file
5
vendor/github.com/gobuffalo/envy/.env
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# This is a comment
|
||||
# We can use equal or colon notation
|
||||
DIR: root
|
||||
FLAVOUR: none
|
||||
INSIDE_FOLDER=false
|
29
vendor/github.com/gobuffalo/envy/.gitignore
generated
vendored
Normal file
29
vendor/github.com/gobuffalo/envy/.gitignore
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
doc
|
||||
tmp
|
||||
pkg
|
||||
*.gem
|
||||
*.pid
|
||||
coverage
|
||||
coverage.data
|
||||
build/*
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
.svn
|
||||
profile
|
||||
.console_history
|
||||
.sass-cache/*
|
||||
.rake_tasks~
|
||||
*.log.lck
|
||||
solr/
|
||||
.jhw-cache/
|
||||
jhw.*
|
||||
*.sublime*
|
||||
node_modules/
|
||||
dist/
|
||||
generated/
|
||||
.vendor/
|
||||
bin/*
|
||||
gin-bin
|
||||
.idea/
|
3
vendor/github.com/gobuffalo/envy/.gometalinter.json
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/envy/.gometalinter.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"]
|
||||
}
|
26
vendor/github.com/gobuffalo/envy/.travis.yml
generated
vendored
Normal file
26
vendor/github.com/gobuffalo/envy/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- go: "1.9.x"
|
||||
- go: "1.10.x"
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
allow_failures:
|
||||
- go: "tip"
|
||||
|
||||
install: make deps
|
||||
|
||||
script: make ci-test
|
8
vendor/github.com/gobuffalo/envy/LICENSE.txt
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/envy/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2018 Mark Bates
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
46
vendor/github.com/gobuffalo/envy/Makefile
generated
vendored
Normal file
46
vendor/github.com/gobuffalo/envy/Makefile
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
TAGS ?= "sqlite"
|
||||
GO_BIN ?= go
|
||||
|
||||
install:
|
||||
packr
|
||||
$(GO_BIN) install -v .
|
||||
|
||||
deps:
|
||||
$(GO_BIN) get github.com/gobuffalo/release
|
||||
$(GO_BIN) get github.com/gobuffalo/packr/packr
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
endif
|
||||
|
||||
build:
|
||||
packr
|
||||
$(GO_BIN) build -v .
|
||||
|
||||
test:
|
||||
packr
|
||||
$(GO_BIN) test -tags ${TAGS} ./...
|
||||
|
||||
ci-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
|
||||
lint:
|
||||
gometalinter --vendor ./... --deadline=1m --skip=internal
|
||||
|
||||
update:
|
||||
$(GO_BIN) get -u -tags ${TAGS}
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
endif
|
||||
packr
|
||||
make test
|
||||
make install
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
endif
|
||||
|
||||
release-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
|
||||
release:
|
||||
release -y -f version.go
|
93
vendor/github.com/gobuffalo/envy/README.md
generated
vendored
Normal file
93
vendor/github.com/gobuffalo/envy/README.md
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
# envy
|
||||
[](https://travis-ci.org/gobuffalo/envy)
|
||||
|
||||
Envy makes working with ENV variables in Go trivial.
|
||||
|
||||
* Get ENV variables with default values.
|
||||
* Set ENV variables safely without affecting the underlying system.
|
||||
* Temporarily change ENV vars; useful for testing.
|
||||
* Map all of the key/values in the ENV.
|
||||
* Loads .env files (by using [godotenv](https://github.com/joho/godotenv/))
|
||||
* More!
|
||||
|
||||
## Installation
|
||||
|
||||
```text
|
||||
$ go get -u github.com/gobuffalo/envy
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
func Test_Get(t *testing.T) {
|
||||
r := require.New(t)
|
||||
r.NotZero(os.Getenv("GOPATH"))
|
||||
r.Equal(os.Getenv("GOPATH"), envy.Get("GOPATH", "foo"))
|
||||
r.Equal("bar", envy.Get("IDONTEXIST", "bar"))
|
||||
}
|
||||
|
||||
func Test_MustGet(t *testing.T) {
|
||||
r := require.New(t)
|
||||
r.NotZero(os.Getenv("GOPATH"))
|
||||
v, err := envy.MustGet("GOPATH")
|
||||
r.NoError(err)
|
||||
r.Equal(os.Getenv("GOPATH"), v)
|
||||
|
||||
_, err = envy.MustGet("IDONTEXIST")
|
||||
r.Error(err)
|
||||
}
|
||||
|
||||
func Test_Set(t *testing.T) {
|
||||
r := require.New(t)
|
||||
_, err := envy.MustGet("FOO")
|
||||
r.Error(err)
|
||||
|
||||
envy.Set("FOO", "foo")
|
||||
r.Equal("foo", envy.Get("FOO", "bar"))
|
||||
}
|
||||
|
||||
func Test_Temp(t *testing.T) {
|
||||
r := require.New(t)
|
||||
|
||||
_, err := envy.MustGet("BAR")
|
||||
r.Error(err)
|
||||
|
||||
envy.Temp(func() {
|
||||
envy.Set("BAR", "foo")
|
||||
r.Equal("foo", envy.Get("BAR", "bar"))
|
||||
_, err = envy.MustGet("BAR")
|
||||
r.NoError(err)
|
||||
})
|
||||
|
||||
_, err = envy.MustGet("BAR")
|
||||
r.Error(err)
|
||||
}
|
||||
```
|
||||
## .env files support
|
||||
|
||||
Envy now supports loading `.env` files by using the [godotenv library](https://github.com/joho/godotenv/).
|
||||
That means one can use and define multiple `.env` files which will be loaded on-demand. By default, no env files will be loaded. To load one or more, you need to call the `envy.Load` function in one of the following ways:
|
||||
|
||||
```go
|
||||
envy.Load() // 1
|
||||
|
||||
envy.Load("MY_ENV_FILE") // 2
|
||||
|
||||
envy.Load(".env", ".env.prod") // 3
|
||||
|
||||
envy.Load(".env", "NON_EXISTING_FILE") // 4
|
||||
|
||||
// 5
|
||||
envy.Load(".env")
|
||||
envy.Load("NON_EXISTING_FILE")
|
||||
|
||||
// 6
|
||||
envy.Load(".env", "NON_EXISTING_FILE", ".env.prod")
|
||||
```
|
||||
|
||||
1. Will load the default `.env` file
|
||||
2. Will load the file `MY_ENV_FILE`, **but not** `.env`
|
||||
3. Will load the file `.env`, and after that will load the `.env.prod` file. If any variable is redefined in `. env.prod` it will be overwritten (will contain the `env.prod` value)
|
||||
4. Will load the `.env` file and return an error as the second file does not exist. The values in `.env` will be loaded and available.
|
||||
5. Same as 4
|
||||
6. Will load the `.env` file and return an error as the second file does not exist. The values in `.env` will be loaded and available, **but the ones in** `.env.prod` **won't**.
|
249
vendor/github.com/gobuffalo/envy/envy.go
generated
vendored
Normal file
249
vendor/github.com/gobuffalo/envy/envy.go
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
package envy makes working with ENV variables in Go trivial.
|
||||
|
||||
* Get ENV variables with default values.
|
||||
* Set ENV variables safely without affecting the underlying system.
|
||||
* Temporarily change ENV vars; useful for testing.
|
||||
* Map all of the key/values in the ENV.
|
||||
* Loads .env files (by using [godotenv](https://github.com/joho/godotenv/))
|
||||
* More!
|
||||
*/
|
||||
package envy
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
var gil = &sync.RWMutex{}
|
||||
var env = map[string]string{}
|
||||
|
||||
// GO111MODULE is ENV for turning mods on/off
|
||||
const GO111MODULE = "GO111MODULE"
|
||||
|
||||
func init() {
|
||||
Load()
|
||||
loadEnv()
|
||||
}
|
||||
|
||||
// Load the ENV variables to the env map
|
||||
func loadEnv() {
|
||||
gil.Lock()
|
||||
defer gil.Unlock()
|
||||
// Detect the Go version on the user system, not the one that was used to compile the binary
|
||||
v := ""
|
||||
out, err := exec.Command("go", "version").Output()
|
||||
if err == nil {
|
||||
// This will break when Go 2 lands
|
||||
v = strings.Split(string(out), " ")[2][4:]
|
||||
} else {
|
||||
v = runtime.Version()[4:]
|
||||
}
|
||||
|
||||
goRuntimeVersion, _ := strconv.ParseFloat(runtime.Version()[4:], 64)
|
||||
|
||||
goVersion, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
goVersion = goRuntimeVersion
|
||||
}
|
||||
|
||||
if os.Getenv("GO_ENV") == "" {
|
||||
// if the flag "test.v" is *defined*, we're running as a unit test. Note that we don't care
|
||||
// about v.Value (verbose test mode); we just want to know if the test environment has defined
|
||||
// it. It's also possible that the flags are not yet fully parsed (i.e. flag.Parsed() == false),
|
||||
// so we could not depend on v.Value anyway.
|
||||
//
|
||||
if v := flag.Lookup("test.v"); v != nil {
|
||||
env["GO_ENV"] = "test"
|
||||
}
|
||||
}
|
||||
|
||||
// set the GOPATH if using >= 1.8 and the GOPATH isn't set
|
||||
if goVersion >= 8 && os.Getenv("GOPATH") == "" {
|
||||
out, err := exec.Command("go", "env", "GOPATH").Output()
|
||||
if err == nil {
|
||||
gp := strings.TrimSpace(string(out))
|
||||
os.Setenv("GOPATH", gp)
|
||||
}
|
||||
}
|
||||
|
||||
for _, e := range os.Environ() {
|
||||
pair := strings.Split(e, "=")
|
||||
env[pair[0]] = os.Getenv(pair[0])
|
||||
}
|
||||
}
|
||||
|
||||
func Mods() bool {
|
||||
return Get(GO111MODULE, "off") == "on"
|
||||
}
|
||||
|
||||
// Reload the ENV variables. Useful if
|
||||
// an external ENV manager has been used
|
||||
func Reload() {
|
||||
env = map[string]string{}
|
||||
loadEnv()
|
||||
}
|
||||
|
||||
// Load .env files. Files will be loaded in the same order that are received.
|
||||
// Redefined vars will override previously existing values.
|
||||
// IE: envy.Load(".env", "test_env/.env") will result in DIR=test_env
|
||||
// If no arg passed, it will try to load a .env file.
|
||||
func Load(files ...string) error {
|
||||
|
||||
// If no files received, load the default one
|
||||
if len(files) == 0 {
|
||||
err := godotenv.Overload()
|
||||
if err == nil {
|
||||
Reload()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// We received a list of files
|
||||
for _, file := range files {
|
||||
|
||||
// Check if it exists or we can access
|
||||
if _, err := os.Stat(file); err != nil {
|
||||
// It does not exist or we can not access.
|
||||
// Return and stop loading
|
||||
return err
|
||||
}
|
||||
|
||||
// It exists and we have permission. Load it
|
||||
if err := godotenv.Overload(file); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Reload the env so all new changes are noticed
|
||||
Reload()
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get a value from the ENV. If it doesn't exist the
|
||||
// default value will be returned.
|
||||
func Get(key string, value string) string {
|
||||
gil.RLock()
|
||||
defer gil.RUnlock()
|
||||
if v, ok := env[key]; ok {
|
||||
return v
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// Get a value from the ENV. If it doesn't exist
|
||||
// an error will be returned
|
||||
func MustGet(key string) (string, error) {
|
||||
gil.RLock()
|
||||
defer gil.RUnlock()
|
||||
if v, ok := env[key]; ok {
|
||||
return v, nil
|
||||
}
|
||||
return "", fmt.Errorf("could not find ENV var with %s", key)
|
||||
}
|
||||
|
||||
// Set a value into the ENV. This is NOT permanent. It will
|
||||
// only affect values accessed through envy.
|
||||
func Set(key string, value string) {
|
||||
gil.Lock()
|
||||
defer gil.Unlock()
|
||||
env[key] = value
|
||||
}
|
||||
|
||||
// MustSet the value into the underlying ENV, as well as envy.
|
||||
// This may return an error if there is a problem setting the
|
||||
// underlying ENV value.
|
||||
func MustSet(key string, value string) error {
|
||||
gil.Lock()
|
||||
defer gil.Unlock()
|
||||
err := os.Setenv(key, value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
env[key] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
// Map all of the keys/values set in envy.
|
||||
func Map() map[string]string {
|
||||
gil.RLock()
|
||||
defer gil.RUnlock()
|
||||
cp := map[string]string{}
|
||||
for k, v := range env {
|
||||
cp[k] = v
|
||||
}
|
||||
return env
|
||||
}
|
||||
|
||||
// Temp makes a copy of the values and allows operation on
|
||||
// those values temporarily during the run of the function.
|
||||
// At the end of the function run the copy is discarded and
|
||||
// the original values are replaced. This is useful for testing.
|
||||
// Warning: This function is NOT safe to use from a goroutine or
|
||||
// from code which may access any Get or Set function from a goroutine
|
||||
func Temp(f func()) {
|
||||
oenv := env
|
||||
env = map[string]string{}
|
||||
for k, v := range oenv {
|
||||
env[k] = v
|
||||
}
|
||||
defer func() { env = oenv }()
|
||||
f()
|
||||
}
|
||||
|
||||
func GoPath() string {
|
||||
return Get("GOPATH", "")
|
||||
}
|
||||
|
||||
func GoBin() string {
|
||||
return Get("GO_BIN", "go")
|
||||
}
|
||||
|
||||
// GoPaths returns all possible GOPATHS that are set.
|
||||
func GoPaths() []string {
|
||||
gp := Get("GOPATH", "")
|
||||
if runtime.GOOS == "windows" {
|
||||
return strings.Split(gp, ";") // Windows uses a different separator
|
||||
}
|
||||
return strings.Split(gp, ":")
|
||||
}
|
||||
|
||||
func importPath(path string) string {
|
||||
for _, gopath := range GoPaths() {
|
||||
srcpath := filepath.Join(gopath, "src")
|
||||
rel, err := filepath.Rel(srcpath, path)
|
||||
if err == nil {
|
||||
return filepath.ToSlash(rel)
|
||||
}
|
||||
}
|
||||
|
||||
// fallback to trim
|
||||
rel := strings.TrimPrefix(path, filepath.Join(GoPath(), "src"))
|
||||
rel = strings.TrimPrefix(rel, string(filepath.Separator))
|
||||
return filepath.ToSlash(rel)
|
||||
}
|
||||
|
||||
func CurrentPackage() string {
|
||||
pwd, _ := os.Getwd()
|
||||
return importPath(pwd)
|
||||
}
|
||||
|
||||
func Environ() []string {
|
||||
gil.RLock()
|
||||
defer gil.RUnlock()
|
||||
var e []string
|
||||
for k, v := range env {
|
||||
e = append(e, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
return e
|
||||
}
|
8
vendor/github.com/gobuffalo/envy/go.mod
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/envy/go.mod
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module github.com/gobuffalo/envy
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/joho/godotenv v1.3.0
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
8
vendor/github.com/gobuffalo/envy/go.sum
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/envy/go.sum
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
10
vendor/github.com/gobuffalo/envy/shoulders.md
generated
vendored
Normal file
10
vendor/github.com/gobuffalo/envy/shoulders.md
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# github.com/gobuffalo/envy Stands on the Shoulders of Giants
|
||||
|
||||
github.com/gobuffalo/envy does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
|
||||
|
||||
Thank you to the following **GIANTS**:
|
||||
|
||||
|
||||
* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy)
|
||||
|
||||
* [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv)
|
3
vendor/github.com/gobuffalo/envy/version.go
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/envy/version.go
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
package envy
|
||||
|
||||
const Version = "v1.6.7"
|
29
vendor/github.com/gobuffalo/packd/.gitignore
generated
vendored
Normal file
29
vendor/github.com/gobuffalo/packd/.gitignore
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
doc
|
||||
tmp
|
||||
pkg
|
||||
*.gem
|
||||
*.pid
|
||||
coverage
|
||||
coverage.data
|
||||
build/*
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
.svn
|
||||
profile
|
||||
.console_history
|
||||
.sass-cache/*
|
||||
.rake_tasks~
|
||||
*.log.lck
|
||||
solr/
|
||||
.jhw-cache/
|
||||
jhw.*
|
||||
*.sublime*
|
||||
node_modules/
|
||||
dist/
|
||||
generated/
|
||||
.vendor/
|
||||
bin/*
|
||||
gin-bin
|
||||
.idea/
|
3
vendor/github.com/gobuffalo/packd/.gometalinter.json
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/packd/.gometalinter.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"]
|
||||
}
|
26
vendor/github.com/gobuffalo/packd/.travis.yml
generated
vendored
Normal file
26
vendor/github.com/gobuffalo/packd/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- go: "1.9.x"
|
||||
- go: "1.10.x"
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
allow_failures:
|
||||
- go: "tip"
|
||||
|
||||
install: make deps
|
||||
|
||||
script: make ci-test
|
21
vendor/github.com/gobuffalo/packd/LICENSE
generated
vendored
Normal file
21
vendor/github.com/gobuffalo/packd/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Mark Bates
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
55
vendor/github.com/gobuffalo/packd/Makefile
generated
vendored
Normal file
55
vendor/github.com/gobuffalo/packd/Makefile
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
TAGS ?= "sqlite"
|
||||
GO_BIN ?= go
|
||||
|
||||
install:
|
||||
packr
|
||||
$(GO_BIN) install -tags ${TAGS} -v .
|
||||
make tidy
|
||||
|
||||
tidy:
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
else
|
||||
echo skipping go mod tidy
|
||||
endif
|
||||
|
||||
deps:
|
||||
$(GO_BIN) get github.com/gobuffalo/release
|
||||
$(GO_BIN) get github.com/gobuffalo/packr/packr
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
make tidy
|
||||
|
||||
build:
|
||||
packr
|
||||
$(GO_BIN) build -v .
|
||||
make tidy
|
||||
|
||||
test:
|
||||
packr
|
||||
$(GO_BIN) test -tags ${TAGS} ./...
|
||||
make tidy
|
||||
|
||||
ci-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
make tidy
|
||||
|
||||
lint:
|
||||
gometalinter --vendor ./... --deadline=1m --skip=internal
|
||||
make tidy
|
||||
|
||||
update:
|
||||
$(GO_BIN) get -u -tags ${TAGS}
|
||||
make tidy
|
||||
packr
|
||||
make test
|
||||
make install
|
||||
make tidy
|
||||
|
||||
release-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
make tidy
|
||||
|
||||
release:
|
||||
make tidy
|
||||
release -y -f version.go
|
||||
make tidy
|
24
vendor/github.com/gobuffalo/packd/README.md
generated
vendored
Normal file
24
vendor/github.com/gobuffalo/packd/README.md
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<p align="center"><img src="https://github.com/gobuffalo/buffalo/blob/master/logo.svg" width="360"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://godoc.org/github.com/gobuffalo/packd"><img src="https://godoc.org/github.com/gobuffalo/packd?status.svg" alt="GoDoc" /></a>
|
||||
<a href="https://travis-ci.org/gobuffalo/packd"><img src="https://travis-ci.org/gobuffalo/packd.svg?branch=master" alt="Build Status" /></a>
|
||||
<a href="https://goreportcard.com/report/github.com/gobuffalo/packd"><img src="https://goreportcard.com/badge/github.com/gobuffalo/packd" alt="Go Report Card" /></a>
|
||||
</p>
|
||||
|
||||
# github.com/gobuffalo/packd
|
||||
|
||||
This is a collection of interfaces designed to make using [github.com/gobuffalo/packr](https://github.com/gobuffalo/packr) easier, and to make the transition between v1 and v2 as seamless as possible.
|
||||
|
||||
They can, and should, be used for testing, alternate Box implementations, etc...
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ go get -u -v github.com/gobuffalo/packd
|
||||
```
|
||||
|
||||
## Memory Box
|
||||
|
||||
The [`packd#MemoryBox`](https://godoc.org/github.com/gobuffalo/packd#MemoryBox) is a complete, thread-safe, implementation of [`packd#Box`](https://godoc.org/github.com/gobuffalo/packd#Box)
|
104
vendor/github.com/gobuffalo/packd/file.go
generated
vendored
Normal file
104
vendor/github.com/gobuffalo/packd/file.go
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var _ File = &virtualFile{}
|
||||
var _ io.Reader = &virtualFile{}
|
||||
var _ io.Writer = &virtualFile{}
|
||||
var _ fmt.Stringer = &virtualFile{}
|
||||
|
||||
type virtualFile struct {
|
||||
buf *bytes.Buffer
|
||||
name string
|
||||
info fileInfo
|
||||
}
|
||||
|
||||
func (f virtualFile) Name() string {
|
||||
return f.name
|
||||
}
|
||||
|
||||
func (f virtualFile) Seek(offset int64, whence int) (int64, error) {
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) FileInfo() (os.FileInfo, error) {
|
||||
return f.info, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||
return []os.FileInfo{f.info}, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Stat() (os.FileInfo, error) {
|
||||
return f.info, nil
|
||||
}
|
||||
|
||||
func (s *virtualFile) String() string {
|
||||
return s.buf.String()
|
||||
}
|
||||
|
||||
func (s *virtualFile) Read(p []byte) (int, error) {
|
||||
return s.buf.Read(p)
|
||||
}
|
||||
|
||||
func (s *virtualFile) Write(p []byte) (int, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
i, err := bb.Write(p)
|
||||
if err != nil {
|
||||
return i, errors.WithStack(err)
|
||||
}
|
||||
s.buf = bb
|
||||
s.info = fileInfo{
|
||||
Path: s.name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
// NewDir returns a new "virtual" file
|
||||
func NewFile(name string, r io.Reader) (File, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
if r != nil {
|
||||
io.Copy(bb, r)
|
||||
}
|
||||
return &virtualFile{
|
||||
buf: bb,
|
||||
name: name,
|
||||
info: fileInfo{
|
||||
Path: name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewDir returns a new "virtual" directory
|
||||
func NewDir(name string) (File, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
return &virtualFile{
|
||||
buf: bb,
|
||||
name: name,
|
||||
info: fileInfo{
|
||||
Path: name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
isDir: true,
|
||||
},
|
||||
}, nil
|
||||
}
|
40
vendor/github.com/gobuffalo/packd/file_info.go
generated
vendored
Normal file
40
vendor/github.com/gobuffalo/packd/file_info.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ os.FileInfo = fileInfo{}
|
||||
|
||||
type fileInfo struct {
|
||||
Path string
|
||||
Contents []byte
|
||||
size int64
|
||||
modTime time.Time
|
||||
isDir bool
|
||||
}
|
||||
|
||||
func (f fileInfo) Name() string {
|
||||
return f.Path
|
||||
}
|
||||
|
||||
func (f fileInfo) Size() int64 {
|
||||
return f.size
|
||||
}
|
||||
|
||||
func (f fileInfo) Mode() os.FileMode {
|
||||
return 0444
|
||||
}
|
||||
|
||||
func (f fileInfo) ModTime() time.Time {
|
||||
return f.modTime
|
||||
}
|
||||
|
||||
func (f fileInfo) IsDir() bool {
|
||||
return f.isDir
|
||||
}
|
||||
|
||||
func (f fileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
8
vendor/github.com/gobuffalo/packd/go.mod
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/packd/go.mod
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module github.com/gobuffalo/packd
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.8.0
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
8
vendor/github.com/gobuffalo/packd/go.sum
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/packd/go.sum
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
79
vendor/github.com/gobuffalo/packd/interfaces.go
generated
vendored
Normal file
79
vendor/github.com/gobuffalo/packd/interfaces.go
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
type WalkFunc func(string, File) error
|
||||
|
||||
// Box represents the entirety of the necessary
|
||||
// interfaces to form a "full" box.
|
||||
// github.com/gobuffalo/packr#Box is an example of this interface.
|
||||
type Box interface {
|
||||
HTTPBox
|
||||
Lister
|
||||
Addable
|
||||
Finder
|
||||
Walkable
|
||||
Haser
|
||||
}
|
||||
|
||||
type Haser interface {
|
||||
Has(string) bool
|
||||
}
|
||||
|
||||
type Walkable interface {
|
||||
Walk(wf WalkFunc) error
|
||||
WalkPrefix(prefix string, wf WalkFunc) error
|
||||
}
|
||||
|
||||
type Finder interface {
|
||||
Find(string) ([]byte, error)
|
||||
FindString(name string) (string, error)
|
||||
}
|
||||
|
||||
type HTTPBox interface {
|
||||
Open(name string) (http.File, error)
|
||||
}
|
||||
|
||||
type Lister interface {
|
||||
List() []string
|
||||
}
|
||||
|
||||
type Addable interface {
|
||||
AddString(path string, t string) error
|
||||
AddBytes(path string, t []byte) error
|
||||
}
|
||||
|
||||
type SimpleFile interface {
|
||||
fmt.Stringer
|
||||
io.Reader
|
||||
io.Writer
|
||||
Name() string
|
||||
}
|
||||
|
||||
type HTTPFile interface {
|
||||
SimpleFile
|
||||
io.Closer
|
||||
io.Seeker
|
||||
Readdir(count int) ([]os.FileInfo, error)
|
||||
Stat() (os.FileInfo, error)
|
||||
}
|
||||
|
||||
type File interface {
|
||||
HTTPFile
|
||||
FileInfo() (os.FileInfo, error)
|
||||
}
|
||||
|
||||
// LegacyBox represents deprecated methods
|
||||
// that older Box implementations might have had.
|
||||
// github.com/gobuffalo/packr v1 is an example of a LegacyBox.
|
||||
type LegacyBox interface {
|
||||
String(name string) string
|
||||
MustString(name string) (string, error)
|
||||
Bytes(name string) []byte
|
||||
MustBytes(name string) ([]byte, error)
|
||||
}
|
148
vendor/github.com/gobuffalo/packd/memory_box.go
generated
vendored
Normal file
148
vendor/github.com/gobuffalo/packd/memory_box.go
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var _ Addable = NewMemoryBox()
|
||||
var _ Finder = NewMemoryBox()
|
||||
var _ Lister = NewMemoryBox()
|
||||
var _ HTTPBox = NewMemoryBox()
|
||||
var _ Haser = NewMemoryBox()
|
||||
var _ Walkable = NewMemoryBox()
|
||||
var _ Box = NewMemoryBox()
|
||||
|
||||
// MemoryBox is a thread-safe, in-memory, implementation of the Box interface.
|
||||
type MemoryBox struct {
|
||||
files *sync.Map
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Has(path string) bool {
|
||||
_, ok := m.files.Load(path)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (m *MemoryBox) List() []string {
|
||||
var names []string
|
||||
m.files.Range(func(key interface{}, value interface{}) bool {
|
||||
if s, ok := key.(string); ok {
|
||||
names = append(names, s)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
sort.Strings(names)
|
||||
return names
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Open(path string) (http.File, error) {
|
||||
cpath := strings.TrimPrefix(path, "/")
|
||||
|
||||
if filepath.Ext(cpath) == "" {
|
||||
// it's a directory
|
||||
return NewDir(path)
|
||||
}
|
||||
|
||||
if len(cpath) == 0 {
|
||||
cpath = "index.html"
|
||||
}
|
||||
|
||||
b, err := m.Find(cpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cpath = filepath.FromSlash(cpath)
|
||||
|
||||
f, err := NewFile(cpath, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) FindString(path string) (string, error) {
|
||||
bb, err := m.Find(path)
|
||||
return string(bb), err
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Find(path string) ([]byte, error) {
|
||||
res, ok := m.files.Load(strings.ToLower(path))
|
||||
if !ok {
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
b, ok := res.([]byte)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected []byte got %T", res)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) AddString(path string, t string) error {
|
||||
return m.AddBytes(path, []byte(t))
|
||||
}
|
||||
|
||||
func (m *MemoryBox) AddBytes(path string, t []byte) error {
|
||||
m.files.Store(strings.ToLower(path), t)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Walk(wf WalkFunc) error {
|
||||
var err error
|
||||
m.files.Range(func(key interface{}, res interface{}) bool {
|
||||
|
||||
path, ok := key.(string)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected string got %T", key)
|
||||
return false
|
||||
}
|
||||
|
||||
b, ok := res.([]byte)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected []byte got %T", res)
|
||||
return false
|
||||
}
|
||||
|
||||
var f File
|
||||
f, err = NewFile(path, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
err = wf(path, f)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *MemoryBox) WalkPrefix(pre string, wf WalkFunc) error {
|
||||
return m.Walk(func(path string, file File) error {
|
||||
if strings.HasPrefix(path, pre) {
|
||||
return wf(path, file)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Remove(path string) {
|
||||
m.files.Delete(path)
|
||||
}
|
||||
|
||||
// NewMemoryBox returns a configured *MemoryBox
|
||||
func NewMemoryBox() *MemoryBox {
|
||||
return &MemoryBox{
|
||||
files: &sync.Map{},
|
||||
}
|
||||
}
|
4
vendor/github.com/gobuffalo/packd/version.go
generated
vendored
Normal file
4
vendor/github.com/gobuffalo/packd/version.go
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
package packd
|
||||
|
||||
// Version of packd
|
||||
const Version = "v0.0.1"
|
20
vendor/github.com/gobuffalo/packr/.codeclimate.yml
generated
vendored
Normal file
20
vendor/github.com/gobuffalo/packr/.codeclimate.yml
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
engines:
|
||||
golint:
|
||||
enabled: true
|
||||
checks:
|
||||
GoLint/Naming/MixedCaps:
|
||||
enabled: false
|
||||
govet:
|
||||
enabled: true
|
||||
gofmt:
|
||||
enabled: true
|
||||
fixme:
|
||||
enabled: true
|
||||
ratings:
|
||||
paths:
|
||||
- "**.go"
|
||||
exclude_paths:
|
||||
- "**/*_test.go"
|
||||
- "*_test.go"
|
||||
- "fixtures/"
|
33
vendor/github.com/gobuffalo/packr/.gitignore
generated
vendored
Normal file
33
vendor/github.com/gobuffalo/packr/.gitignore
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
doc
|
||||
tmp
|
||||
pkg
|
||||
*.gem
|
||||
*.pid
|
||||
coverage
|
||||
coverage.data
|
||||
build/*
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
.svn
|
||||
profile
|
||||
.console_history
|
||||
.sass-cache/*
|
||||
.rake_tasks~
|
||||
*.log.lck
|
||||
solr/
|
||||
.jhw-cache/
|
||||
jhw.*
|
||||
*.sublime*
|
||||
node_modules/
|
||||
dist/
|
||||
generated/
|
||||
.vendor/
|
||||
bin/*
|
||||
gin-bin
|
||||
/packr_darwin_amd64
|
||||
/packr_linux_amd64
|
||||
.vscode/
|
||||
debug.test
|
||||
.grifter/
|
46
vendor/github.com/gobuffalo/packr/.goreleaser.yml
generated
vendored
Normal file
46
vendor/github.com/gobuffalo/packr/.goreleaser.yml
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
# Code generated by github.com/gobuffalo/release. DO NOT EDIT.
|
||||
# Edit .goreleaser.yml.plush instead
|
||||
|
||||
builds:
|
||||
-
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
- windows
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./packr/main.go
|
||||
binary: packr
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
brew:
|
||||
github:
|
||||
owner: gobuffalo
|
||||
name: homebrew-tap
|
16
vendor/github.com/gobuffalo/packr/.travis.yml
generated
vendored
Normal file
16
vendor/github.com/gobuffalo/packr/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
go:
|
||||
- 1.9
|
||||
- "1.10"
|
||||
- "1.11"
|
||||
- tip
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: 'tip'
|
||||
|
||||
script:
|
||||
- make ci-test
|
8
vendor/github.com/gobuffalo/packr/LICENSE.txt
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/packr/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2016 Mark Bates
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
36
vendor/github.com/gobuffalo/packr/Makefile
generated
vendored
Normal file
36
vendor/github.com/gobuffalo/packr/Makefile
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
TAGS ?= "sqlite"
|
||||
GO_BIN ?= go
|
||||
|
||||
install: deps
|
||||
packr
|
||||
$(GO_BIN) install -v .
|
||||
|
||||
deps:
|
||||
$(GO_BIN) get github.com/gobuffalo/packr/packr
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
|
||||
build: deps
|
||||
packr
|
||||
$(GO_BIN) build -v .
|
||||
|
||||
test:
|
||||
packr
|
||||
$(GO_BIN) test -tags ${TAGS} ./...
|
||||
|
||||
ci-test: deps
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
|
||||
lint:
|
||||
gometalinter --vendor ./... --deadline=1m --skip=internal
|
||||
|
||||
update:
|
||||
$(GO_BIN) get -u
|
||||
$(GO_BIN) mod tidy
|
||||
packr
|
||||
make test
|
||||
|
||||
release-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
|
||||
release:
|
||||
release -y -f version.go
|
198
vendor/github.com/gobuffalo/packr/README.md
generated
vendored
Normal file
198
vendor/github.com/gobuffalo/packr/README.md
generated
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
# packr
|
||||
|
||||
[](https://godoc.org/github.com/gobuffalo/packr)
|
||||
|
||||
Packr is a simple solution for bundling static assets inside of Go binaries. Most importantly it does it in a way that is friendly to developers while they are developing.
|
||||
|
||||
## Intro Video
|
||||
|
||||
To get an idea of the what and why of packr, please enjoy this short video: [https://vimeo.com/219863271](https://vimeo.com/219863271).
|
||||
|
||||
## Installation
|
||||
|
||||
To install Packr utility
|
||||
|
||||
```text
|
||||
$ go get -u github.com/gobuffalo/packr/packr
|
||||
```
|
||||
|
||||
To get the dependency
|
||||
|
||||
```text
|
||||
$ go get -u github.com/gobuffalo/packr
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### In Code
|
||||
|
||||
The first step in using Packr is to create a new box. A box represents a folder on disk. Once you have a box you can get `string` or `[]byte` representations of the file.
|
||||
|
||||
```go
|
||||
// set up a new box by giving it a (relative) path to a folder on disk:
|
||||
box := packr.NewBox("./templates")
|
||||
|
||||
// Get the string representation of a file, or an error if it doesn't exist:
|
||||
html, err := box.FindString("index.html")
|
||||
|
||||
// Get the []byte representation of a file, or an error if it doesn't exist:
|
||||
html, err := box.FindBytes("index.html")
|
||||
```
|
||||
|
||||
### What is a Box?
|
||||
|
||||
A box represents a folder, and any sub-folders, on disk that you want to have access to in your binary. When compiling a binary using the `packr` CLI the contents of the folder will be converted into Go files that can be compiled inside of a "standard" go binary. Inside of the compiled binary the files will be read from memory. When working locally the files will be read directly off of disk. This is a seamless switch that doesn't require any special attention on your part.
|
||||
|
||||
#### Example
|
||||
|
||||
Assume the follow directory structure:
|
||||
|
||||
```
|
||||
├── main.go
|
||||
└── templates
|
||||
├── admin
|
||||
│ └── index.html
|
||||
└── index.html
|
||||
```
|
||||
|
||||
The following program will read the `./templates/admin/index.html` file and print it out.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gobuffalo/packr"
|
||||
)
|
||||
|
||||
func main() {
|
||||
box := packr.NewBox("./templates")
|
||||
|
||||
s := box.String("admin/index.html")
|
||||
fmt.Println(s)
|
||||
}
|
||||
```
|
||||
|
||||
### Development Made Easy
|
||||
|
||||
In order to get static files into a Go binary, those files must first be converted to Go code. To do that, Packr, ships with a few tools to help build binaries. See below.
|
||||
|
||||
During development, however, it is painful to have to keep running a tool to compile those files.
|
||||
|
||||
Packr uses the following resolution rules when looking for a file:
|
||||
|
||||
1. Look for the file in-memory (inside a Go binary)
|
||||
1. Look for the file on disk (during development)
|
||||
|
||||
Because Packr knows how to fall through to the file system, developers don't need to worry about constantly compiling their static files into a binary. They can work unimpeded.
|
||||
|
||||
Packr takes file resolution a step further. When declaring a new box you use a relative path, `./templates`. When Packr receives this call it calculates out the absolute path to that directory. By doing this it means you can be guaranteed that Packr can find your files correctly, even if you're not running in the directory that the box was created in. This helps with the problem of testing, where Go changes the `pwd` for each package, making relative paths difficult to work with. This is not a problem when using Packr.
|
||||
|
||||
---
|
||||
|
||||
## Usage with HTTP
|
||||
|
||||
A box implements the [`http.FileSystem`](https://golang.org/pkg/net/http/#FileSystemhttps://golang.org/pkg/net/http/#FileSystem) interface, meaning it can be used to serve static files.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gobuffalo/packr"
|
||||
)
|
||||
|
||||
func main() {
|
||||
box := packr.NewBox("./templates")
|
||||
|
||||
http.Handle("/", http.FileServer(box))
|
||||
http.ListenAndServe(":3000", nil)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Building a Binary (the easy way)
|
||||
|
||||
When it comes time to build, or install, your Go binary, simply use `packr build` or `packr install` just as you would `go build` or `go install`. All flags for the `go` tool are supported and everything works the way you expect, the only difference is your static assets are now bundled in the generated binary. If you want more control over how this happens, looking at the following section on building binaries (the hard way).
|
||||
|
||||
## Building a Binary (the hard way)
|
||||
|
||||
Before you build your Go binary, run the `packr` command first. It will look for all the boxes in your code and then generate `.go` files that pack the static files into bytes that can be bundled into the Go binary.
|
||||
|
||||
```
|
||||
$ packr
|
||||
```
|
||||
|
||||
Then run your `go build command` like normal.
|
||||
|
||||
*NOTE*: It is not recommended to check-in these generated `-packr.go` files. They can be large, and can easily become out of date if not careful. It is recommended that you always run `packr clean` after running the `packr` tool.
|
||||
|
||||
#### Cleaning Up
|
||||
|
||||
When you're done it is recommended that you run the `packr clean` command. This will remove all of the generated files that Packr created for you.
|
||||
|
||||
```
|
||||
$ packr clean
|
||||
```
|
||||
|
||||
Why do you want to do this? Packr first looks to the information stored in these generated files, if the information isn't there it looks to disk. This makes it easy to work with in development.
|
||||
|
||||
---
|
||||
|
||||
## Building/Moving a portable release
|
||||
|
||||
When it comes to building multiple releases you typically want that release to be built in a specific directory.
|
||||
|
||||
For example: `./releases`
|
||||
|
||||
However, because passing a `.go` file requires absolute paths, we must compile the release in the appropriate absolute path.
|
||||
|
||||
```bash
|
||||
GOOS=linux GOARCH=amd64 packr build
|
||||
```
|
||||
|
||||
Now your `project_name` binary will be built at the root of your project dir. Great!
|
||||
|
||||
All that is left to do is to move that binary to your release dir:
|
||||
|
||||
Linux/macOS/Windows (bash)
|
||||
|
||||
```bash
|
||||
mv ./project_name ./releases
|
||||
```
|
||||
|
||||
Windows (cmd):
|
||||
|
||||
```cmd
|
||||
move ./project_name ./releases
|
||||
```
|
||||
|
||||
Powershell:
|
||||
|
||||
```powershell
|
||||
Move-Item -Path .\project_name -Destination .\releases\
|
||||
```
|
||||
|
||||
If you _target_ for Windows when building don't forget that it's `project_name.exe`
|
||||
|
||||
Now you can make multiple releases and all of your needed static files will be available!
|
||||
|
||||
#### Summing it up:
|
||||
|
||||
Example Script for building to 3 common targets:
|
||||
|
||||
```bash
|
||||
GOOS=darwin GOARCH=amd64 packr build && mv ./project_name ./releases/darwin-project_name \
|
||||
&& GOOS=linux GOARCH=amd64 packr build && mv ./project_name ./releases/linux-project_name \
|
||||
&& GOOS=windows GOARCH=386 packr build && mv ./project_name.exe ./releases/project_name.exe \
|
||||
&& packr clean
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Debugging
|
||||
|
||||
The `packr` command passes all arguments down to the underlying `go` command, this includes the `-v` flag to print out `go build` information. Packr looks for the `-v` flag, and will turn on its own verbose logging. This is very useful for trying to understand what the `packr` command is doing when it is run.
|
231
vendor/github.com/gobuffalo/packr/box.go
generated
vendored
Normal file
231
vendor/github.com/gobuffalo/packr/box.go
generated
vendored
Normal file
@ -0,0 +1,231 @@
|
||||
package packr
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/gobuffalo/packd"
|
||||
"github.com/markbates/oncer"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrResOutsideBox gets returned in case of the requested resources being outside the box
|
||||
ErrResOutsideBox = errors.New("Can't find a resource outside the box")
|
||||
)
|
||||
|
||||
var _ packd.Box = Box{}
|
||||
var _ packd.HTTPBox = Box{}
|
||||
var _ packd.Lister = Box{}
|
||||
var _ packd.Addable = Box{}
|
||||
var _ packd.Walkable = Box{}
|
||||
var _ packd.Finder = Box{}
|
||||
var _ packd.LegacyBox = Box{}
|
||||
|
||||
// NewBox returns a Box that can be used to
|
||||
// retrieve files from either disk or the embedded
|
||||
// binary.
|
||||
func NewBox(path string) Box {
|
||||
var cd string
|
||||
if !filepath.IsAbs(path) {
|
||||
_, filename, _, _ := runtime.Caller(1)
|
||||
cd = filepath.Dir(filename)
|
||||
}
|
||||
|
||||
// this little hack courtesy of the `-cover` flag!!
|
||||
cov := filepath.Join("_test", "_obj_test")
|
||||
cd = strings.Replace(cd, string(filepath.Separator)+cov, "", 1)
|
||||
if !filepath.IsAbs(cd) && cd != "" {
|
||||
cd = filepath.Join(GoPath(), "src", cd)
|
||||
}
|
||||
|
||||
return Box{
|
||||
Path: path,
|
||||
callingDir: cd,
|
||||
data: map[string][]byte{},
|
||||
}
|
||||
}
|
||||
|
||||
// Box represent a folder on a disk you want to
|
||||
// have access to in the built Go binary.
|
||||
type Box struct {
|
||||
Path string
|
||||
callingDir string
|
||||
data map[string][]byte
|
||||
directories map[string]bool
|
||||
}
|
||||
|
||||
// AddString converts t to a byteslice and delegates to AddBytes to add to b.data
|
||||
func (b Box) AddString(path string, t string) error {
|
||||
b.AddBytes(path, []byte(t))
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddBytes sets t in b.data by the given path
|
||||
func (b Box) AddBytes(path string, t []byte) error {
|
||||
b.data[path] = t
|
||||
return nil
|
||||
}
|
||||
|
||||
// String is deprecated. Use Find instead
|
||||
func (b Box) String(name string) string {
|
||||
oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.String", "Use github.com/gobuffalo/packr#Box.FindString instead.")
|
||||
bb, _ := b.FindString(name)
|
||||
return bb
|
||||
}
|
||||
|
||||
// MustString is deprecated. Use FindString instead
|
||||
func (b Box) MustString(name string) (string, error) {
|
||||
oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.MustString", "Use github.com/gobuffalo/packr#Box.FindString instead.")
|
||||
return b.FindString(name)
|
||||
}
|
||||
|
||||
// Bytes is deprecated. Use Find instead
|
||||
func (b Box) Bytes(name string) []byte {
|
||||
oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.Bytes", "Use github.com/gobuffalo/packr#Box.Find instead.")
|
||||
bb, _ := b.Find(name)
|
||||
return bb
|
||||
}
|
||||
|
||||
// Bytes is deprecated. Use Find instead
|
||||
func (b Box) MustBytes(name string) ([]byte, error) {
|
||||
oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.MustBytes", "Use github.com/gobuffalo/packr#Box.Find instead.")
|
||||
return b.Find(name)
|
||||
}
|
||||
|
||||
// FindString returns either the string of the requested
|
||||
// file or an error if it can not be found.
|
||||
func (b Box) FindString(name string) (string, error) {
|
||||
bb, err := b.Find(name)
|
||||
return string(bb), err
|
||||
}
|
||||
|
||||
// Find returns either the byte slice of the requested
|
||||
// file or an error if it can not be found.
|
||||
func (b Box) Find(name string) ([]byte, error) {
|
||||
f, err := b.find(name)
|
||||
if err == nil {
|
||||
bb := &bytes.Buffer{}
|
||||
bb.ReadFrom(f)
|
||||
return bb.Bytes(), err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Has returns true if the resource exists in the box
|
||||
func (b Box) Has(name string) bool {
|
||||
_, err := b.find(name)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (b Box) decompress(bb []byte) []byte {
|
||||
reader, err := gzip.NewReader(bytes.NewReader(bb))
|
||||
if err != nil {
|
||||
return bb
|
||||
}
|
||||
data, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
return bb
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func (b Box) find(name string) (File, error) {
|
||||
if bb, ok := b.data[name]; ok {
|
||||
return packd.NewFile(name, bytes.NewReader(bb))
|
||||
}
|
||||
|
||||
if b.directories == nil {
|
||||
b.indexDirectories()
|
||||
}
|
||||
|
||||
cleanName := filepath.ToSlash(filepath.Clean(name))
|
||||
// Ensure name is not outside the box
|
||||
if strings.HasPrefix(cleanName, "../") {
|
||||
return nil, ErrResOutsideBox
|
||||
}
|
||||
// Absolute name is considered as relative to the box root
|
||||
cleanName = strings.TrimPrefix(cleanName, "/")
|
||||
|
||||
if _, ok := data[b.Path]; ok {
|
||||
if bb, ok := data[b.Path][cleanName]; ok {
|
||||
bb = b.decompress(bb)
|
||||
return packd.NewFile(cleanName, bytes.NewReader(bb))
|
||||
}
|
||||
if _, ok := b.directories[cleanName]; ok {
|
||||
return packd.NewDir(cleanName)
|
||||
}
|
||||
if filepath.Ext(cleanName) != "" {
|
||||
// The Handler created by http.FileSystem checks for those errors and
|
||||
// returns http.StatusNotFound instead of http.StatusInternalServerError.
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
|
||||
// Not found in the box virtual fs, try to get it from the file system
|
||||
cleanName = filepath.FromSlash(cleanName)
|
||||
p := filepath.Join(b.callingDir, b.Path, cleanName)
|
||||
return fileFor(p, cleanName)
|
||||
}
|
||||
|
||||
// Open returns a File using the http.File interface
|
||||
func (b Box) Open(name string) (http.File, error) {
|
||||
return b.find(name)
|
||||
}
|
||||
|
||||
// List shows "What's in the box?"
|
||||
func (b Box) List() []string {
|
||||
var keys []string
|
||||
|
||||
if b.data == nil || len(b.data) == 0 {
|
||||
b.Walk(func(path string, info File) error {
|
||||
finfo, _ := info.FileInfo()
|
||||
if !finfo.IsDir() {
|
||||
keys = append(keys, finfo.Name())
|
||||
}
|
||||
return nil
|
||||
})
|
||||
} else {
|
||||
for k := range b.data {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func (b *Box) indexDirectories() {
|
||||
b.directories = map[string]bool{}
|
||||
if _, ok := data[b.Path]; ok {
|
||||
for name := range data[b.Path] {
|
||||
prefix, _ := path.Split(name)
|
||||
// Even on Windows the suffix appears to be a /
|
||||
prefix = strings.TrimSuffix(prefix, "/")
|
||||
b.directories[prefix] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fileFor(p string, name string) (File, error) {
|
||||
fi, err := os.Stat(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if fi.IsDir() {
|
||||
return packd.NewDir(p)
|
||||
}
|
||||
if bb, err := ioutil.ReadFile(p); err == nil {
|
||||
return packd.NewFile(name, bytes.NewReader(bb))
|
||||
}
|
||||
return nil, os.ErrNotExist
|
||||
}
|
13
vendor/github.com/gobuffalo/packr/env.go
generated
vendored
Normal file
13
vendor/github.com/gobuffalo/packr/env.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
package packr
|
||||
|
||||
import (
|
||||
"github.com/gobuffalo/envy"
|
||||
)
|
||||
|
||||
// GoPath returns the current GOPATH env var
|
||||
// or if it's missing, the default.
|
||||
var GoPath = envy.GoPath
|
||||
|
||||
// GoBin returns the current GO_BIN env var
|
||||
// or if it's missing, a default of "go"
|
||||
var GoBin = envy.GoBin
|
5
vendor/github.com/gobuffalo/packr/file.go
generated
vendored
Normal file
5
vendor/github.com/gobuffalo/packr/file.go
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
package packr
|
||||
|
||||
import "github.com/gobuffalo/packd"
|
||||
|
||||
type File = packd.File
|
14
vendor/github.com/gobuffalo/packr/go.mod
generated
vendored
Normal file
14
vendor/github.com/gobuffalo/packr/go.mod
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
module github.com/gobuffalo/packr
|
||||
|
||||
require (
|
||||
github.com/gobuffalo/envy v1.6.7
|
||||
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4
|
||||
github.com/pkg/errors v0.8.0
|
||||
github.com/spf13/cobra v0.0.3
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc // indirect
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
|
||||
)
|
26
vendor/github.com/gobuffalo/packr/go.sum
generated
vendored
Normal file
26
vendor/github.com/gobuffalo/packr/go.sum
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gobuffalo/envy v1.6.7 h1:XMZGuFqTupAXhZTriQ+qO38QvNOSU/0rl3hEPCFci/4=
|
||||
github.com/gobuffalo/envy v1.6.7/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ=
|
||||
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264 h1:roWyi0eEdiFreSqW9V1wT9pNOVzrpo2NWsxja53slX0=
|
||||
github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4 h1:Mlji5gkcpzkqTROyE4ZxZ8hN7osunMb2RuGVrbvMvCc=
|
||||
github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc h1:ZMCWScCvS2fUVFw8LOpxyUUW5qiviqr4Dg5NdjLeiLU=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
74
vendor/github.com/gobuffalo/packr/packr.go
generated
vendored
Normal file
74
vendor/github.com/gobuffalo/packr/packr.go
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
package packr
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var gil = &sync.Mutex{}
|
||||
var data = map[string]map[string][]byte{}
|
||||
|
||||
// PackBytes packs bytes for a file into a box.
|
||||
func PackBytes(box string, name string, bb []byte) {
|
||||
gil.Lock()
|
||||
defer gil.Unlock()
|
||||
if _, ok := data[box]; !ok {
|
||||
data[box] = map[string][]byte{}
|
||||
}
|
||||
data[box][name] = bb
|
||||
}
|
||||
|
||||
// PackBytesGzip packets the gzipped compressed bytes into a box.
|
||||
func PackBytesGzip(box string, name string, bb []byte) error {
|
||||
var buf bytes.Buffer
|
||||
w := gzip.NewWriter(&buf)
|
||||
_, err := w.Write(bb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = w.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
PackBytes(box, name, buf.Bytes())
|
||||
return nil
|
||||
}
|
||||
|
||||
// PackJSONBytes packs JSON encoded bytes for a file into a box.
|
||||
func PackJSONBytes(box string, name string, jbb string) error {
|
||||
var bb []byte
|
||||
err := json.Unmarshal([]byte(jbb), &bb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
PackBytes(box, name, bb)
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpackBytes unpacks bytes for specific box.
|
||||
func UnpackBytes(box string) {
|
||||
gil.Lock()
|
||||
defer gil.Unlock()
|
||||
delete(data, box)
|
||||
}
|
||||
|
||||
func osPaths(paths ...string) []string {
|
||||
if runtime.GOOS == "windows" {
|
||||
for i, path := range paths {
|
||||
paths[i] = strings.Replace(path, "/", "\\", -1)
|
||||
}
|
||||
}
|
||||
|
||||
return paths
|
||||
}
|
||||
|
||||
func osPath(path string) string {
|
||||
if runtime.GOOS == "windows" {
|
||||
return strings.Replace(path, "/", "\\", -1)
|
||||
}
|
||||
return path
|
||||
}
|
18
vendor/github.com/gobuffalo/packr/shoulders.md
generated
vendored
Normal file
18
vendor/github.com/gobuffalo/packr/shoulders.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# github.com/gobuffalo/packr Stands on the Shoulders of Giants
|
||||
|
||||
github.com/gobuffalo/packr does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
|
||||
|
||||
Thank you to the following **GIANTS**:
|
||||
|
||||
|
||||
* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy)
|
||||
|
||||
* [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd)
|
||||
|
||||
* [github.com/gobuffalo/packr](https://godoc.org/github.com/gobuffalo/packr)
|
||||
|
||||
* [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv)
|
||||
|
||||
* [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer)
|
||||
|
||||
* [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors)
|
3
vendor/github.com/gobuffalo/packr/version.go
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/packr/version.go
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
package packr
|
||||
|
||||
const Version = "v1.19.0"
|
64
vendor/github.com/gobuffalo/packr/walk.go
generated
vendored
Normal file
64
vendor/github.com/gobuffalo/packr/walk.go
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
package packr
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/gobuffalo/packd"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type WalkFunc = packd.WalkFunc
|
||||
|
||||
// Walk will traverse the box and call the WalkFunc for each file in the box/folder.
|
||||
func (b Box) Walk(wf WalkFunc) error {
|
||||
if data[b.Path] == nil {
|
||||
base, err := filepath.EvalSymlinks(filepath.Join(b.callingDir, b.Path))
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
return filepath.Walk(base, func(path string, info os.FileInfo, err error) error {
|
||||
cleanName, err := filepath.Rel(base, path)
|
||||
if err != nil {
|
||||
cleanName = strings.TrimPrefix(path, base)
|
||||
}
|
||||
cleanName = filepath.ToSlash(filepath.Clean(cleanName))
|
||||
cleanName = strings.TrimPrefix(cleanName, "/")
|
||||
cleanName = filepath.FromSlash(cleanName)
|
||||
if info == nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
file, err := fileFor(path, cleanName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return wf(cleanName, file)
|
||||
})
|
||||
}
|
||||
for n := range data[b.Path] {
|
||||
f, err := b.find(n)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = wf(n, f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix
|
||||
func (b Box) WalkPrefix(prefix string, wf WalkFunc) error {
|
||||
opre := osPath(prefix)
|
||||
return b.Walk(func(path string, f File) error {
|
||||
if strings.HasPrefix(osPath(path), opre) {
|
||||
if err := wf(path, f); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user