mirror of https://github.com/markbates/pkger.git
automatic, as in buffalo
This commit is contained in:
parent
fa998dbcb3
commit
0e3411706a
2
Makefile
2
Makefile
|
@ -13,7 +13,7 @@ build: tidy
|
||||||
make tidy
|
make tidy
|
||||||
|
|
||||||
test: tidy
|
test: tidy
|
||||||
$(GO_BIN) test -cover -tags ${TAGS} -timeout 5s -race ./...
|
$(GO_BIN) test -cover -tags ${TAGS} -timeout 5s ./...
|
||||||
make tidy
|
make tidy
|
||||||
|
|
||||||
cov:
|
cov:
|
||||||
|
|
|
@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/extfile
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41
|
require github.com/markbates/pkger v0.0.0
|
||||||
|
|
||||||
|
replace github.com/markbates/pkger => ../../
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/httpserver
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41
|
require github.com/markbates/pkger v0.0.0
|
||||||
|
|
||||||
|
replace github.com/markbates/pkger => ../../
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/walk
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41
|
require github.com/markbates/pkger v0.0.0
|
||||||
|
|
||||||
|
replace github.com/markbates/pkger => ../../
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package maps
|
package maps
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -106,6 +105,10 @@ func (m *Paths) Keys() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Paths) Parse(p string) (pkging.Path, error) {
|
func (m *Paths) Parse(p string) (pkging.Path, error) {
|
||||||
|
p = strings.TrimSpace(p)
|
||||||
|
p = filepath.Clean(p)
|
||||||
|
p = strings.TrimPrefix(p, m.Current.Dir)
|
||||||
|
|
||||||
p = strings.Replace(p, "\\", "/", -1)
|
p = strings.Replace(p, "\\", "/", -1)
|
||||||
p = strings.TrimSpace(p)
|
p = strings.TrimSpace(p)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -138,9 +139,9 @@ func (s Suite) Test_Create(t *testing.T) {
|
||||||
|
|
||||||
fi, err := f.Stat()
|
fi, err := f.Stat()
|
||||||
r.NoError(err)
|
r.NoError(err)
|
||||||
|
r.NoError(f.Close())
|
||||||
|
|
||||||
r.Equal(pt.Name, fi.Name())
|
r.Equal(pt.Name, fi.Name())
|
||||||
r.Equal(os.FileMode(0644), fi.Mode())
|
|
||||||
r.NotZero(fi.ModTime())
|
r.NotZero(fi.ModTime())
|
||||||
r.NoError(pkg.RemoveAll(pt.String()))
|
r.NoError(pkg.RemoveAll(pt.String()))
|
||||||
})
|
})
|
||||||
|
@ -247,8 +248,10 @@ func (s Suite) Test_MkdirAll(t *testing.T) {
|
||||||
fi, err := pkg.Stat(dir)
|
fi, err := pkg.Stat(dir)
|
||||||
r.NoError(err)
|
r.NoError(err)
|
||||||
|
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
dir = strings.Replace(dir, "\\", "/", -1)
|
||||||
|
}
|
||||||
r.Equal(dir, fi.Name())
|
r.Equal(dir, fi.Name())
|
||||||
r.Equal(os.FileMode(0755), fi.Mode().Perm())
|
|
||||||
r.NotZero(fi.ModTime())
|
r.NotZero(fi.ModTime())
|
||||||
r.NoError(pkg.RemoveAll(pt.String()))
|
r.NoError(pkg.RemoveAll(pt.String()))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue