Skip to content

Commit

Permalink
change asset from goblet to statik
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoh86 committed Dec 27, 2020
1 parent 2508957 commit c7f8408
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VERSION := `git vertag get`
COMMIT := `git rev-parse HEAD`

gen:
go run github.com/deadcheat/goblet/cmd/goblet -p test -o editor/test/output_test.go --ignore-dotfiles ./sample/out_*.txt
go run github.com/rakyll/statik -src=./sample -dest editor/test -include='*.txt' -f
gofmt -w editor/test/output_test.go

lint: gen
Expand Down
20 changes: 14 additions & 6 deletions editor/test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,37 @@ package test
import (
"bytes"
"io/ioutil"
"path/filepath"
"strings"
"testing"

"github.com/kyoh86/richgo/config"
_ "github.com/kyoh86/richgo/editor/test/statik"
"github.com/rakyll/statik/fs"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestE2E(t *testing.T) {
mustAsset := func(t *testing.T, name string) []byte {
file, err := Assets.File(name)
statikFS, err := fs.New()
if err != nil {
t.Fatalf("failed to find %s: %s", name, err)
t.Fatalf("failed to init statik FS: %s", err.Error())
}
buf, err := ioutil.ReadAll(file)

// Access individual files by their paths.
r, err := statikFS.Open(name)
if err != nil {
t.Fatalf("failed to open %s: %s", name, err)
}
defer r.Close()
buf, err := ioutil.ReadAll(r)
if err != nil {
t.Fatalf("failed to load %s: %s", name, err)
}
return buf
}
raws := bytes.Split(mustAsset(t, filepath.Join("/", "sample", "out_raw.txt")), []byte("\n"))
exps := bytes.Split(mustAsset(t, filepath.Join("/", "sample", "out_colored.txt")), []byte("\n"))
raws := bytes.Split(mustAsset(t, "/out_raw.txt"), []byte("\n"))
exps := bytes.Split(mustAsset(t, "/out_colored.txt"), []byte("\n"))

config.Default()
editor := New()
Expand Down
22 changes: 0 additions & 22 deletions editor/test/output_test.go

This file was deleted.

14 changes: 14 additions & 0 deletions editor/test/statik/statik.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module github.com/kyoh86/richgo

require (
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/deadcheat/goblet v1.3.1
github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81
github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c
github.com/rakyll/statik v0.1.7
github.com/stretchr/testify v1.4.0
github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8
golang.org/x/sys v0.0.0-20170927054621-314a259e304f // indirect
Expand Down
16 changes: 2 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI=
github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deadcheat/goblet v1.3.1 h1:OPOYQjHlbPmG8fFCt8GNNGECLVhaJ0n7F7cP5Mh7G/A=
github.com/deadcheat/goblet v1.3.1/go.mod h1:IrMNyAwyrVgB30HsND2WgleTUM4wHTS9m40yNY6NJQg=
github.com/deadcheat/gonch v0.0.0-20180528124129-c2ff7a019863 h1:WiIagMEsLYiZCeD76SSLTJPdBdnmXkrFOFbI6Chf0xg=
github.com/deadcheat/gonch v0.0.0-20180528124129-c2ff7a019863/go.mod h1:/5mH3gAuXUxGN3maOBAxBfB8RXvP9tBIX5fx2x1k0V0=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81 h1:C2Yb5TxdHWrtWXdf+j8xWW4QQu8lXuxtj1UOK816dpA=
github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38=
github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee h1:tUyoJR5V1TdXnTh9v8c1YAHvDdut2+zkuyUX3gAY/wI=
Expand All @@ -19,14 +8,13 @@ github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8d
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
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/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8 h1:js9Z9dWq50Ttu4D1YRqgS1gkSgRfpKp+rMza4io7qNw=
github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8/go.mod h1:BD0gjsZrCwtoR+yWDB9v2hQ8STlq9tT84qKfa+3txOc=
golang.org/x/net v0.0.0-20180404174746-b3c676e531a6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20170927054621-314a259e304f h1:iUy6hSM2lPBGm2d9HgXq1GqYPwcJvA8ihnWauXggYMs=
golang.org/x/sys v0.0.0-20170927054621-314a259e304f/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down

0 comments on commit c7f8408

Please sign in to comment.