Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Move bindata into app/server package
Browse files Browse the repository at this point in the history
As additional for this commit: 0ad128d
  • Loading branch information
olebedev committed Aug 17, 2015
1 parent d986345 commit c6c0ff5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -3,7 +3,7 @@
/pkg
/src/*
!/src/app
src/app/server/data/bindata.go
src/app/server/bindata.go
src/app/server/data/static/build/

.pid
Expand Down
9 changes: 3 additions & 6 deletions Makefile
Expand Up @@ -2,16 +2,16 @@ BIN = $(GOPATH)/bin
NODE_BIN = $(shell npm bin)
PID = .pid
GO_FILES = $(filter-out bindata.go, $(shell find src/app -type f -name "*.go"))
BINDATA = src/app/server/data/bindata.go
BINDATA_FLAGS = -pkg=data -prefix=src/app/server/data -ignore=src\\/app\\/server\\/data\\/bindata.go
BINDATA = src/app/server/bindata.go
BINDATA_FLAGS = -pkg=server -prefix=src/app/server/data
BUNDLE = src/app/server/data/static/build/bundle.js
APP = $(shell find src/app/client -type f)

build: clean $(BIN)/app

clean:
@rm -rf src/app/server/data/static/build/*
@rm -rf src/app/server/data/bindata.go
@rm -rf $(BINDATA)
@echo cleaned

$(BUNDLE): $(APP)
Expand Down Expand Up @@ -44,6 +44,3 @@ lint:
@eslint src/app/client
@golint -min_confidence=1 app
@golint -min_confidence=1 app/server
@golint -min_confidence=1 app/server/api
@golint -min_confidence=1 app/server/utils
@golint -min_confidence=1 app/server/react
6 changes: 2 additions & 4 deletions src/app/server/app.go
@@ -1,8 +1,6 @@
package server

import (
"app/server/data"

"github.com/elazarl/go-bindata-assetfs"
"github.com/gin-gonic/gin"
"github.com/nu7hatch/gouuid"
Expand Down Expand Up @@ -61,8 +59,8 @@ func NewApp(opts ...AppOptions) *App {

// Define routes and middlewares
app.Engine.StaticFS("/static", &assetfs.AssetFS{
Asset: data.Asset,
AssetDir: data.AssetDir,
Asset: Asset,
AssetDir: AssetDir,
Prefix: "static",
})

Expand Down
3 changes: 1 addition & 2 deletions src/app/server/react.go
@@ -1,7 +1,6 @@
package server

import (
"app/server/data"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -165,7 +164,7 @@ func newDuktapeContext(engine http.Handler) *duktape.Context {
vm := duktape.New()
vm.PevalString(`var console = {log:print,warn:print,error:print,info:print}`)
fetch.Define(vm, engine)
app, err := data.Asset("static/build/bundle.js")
app, err := Asset("static/build/bundle.js")
Must(err)
fmt.Println("static/build/bundle.js loaded")
if err := vm.PevalString(string(app)); err != nil {
Expand Down

0 comments on commit c6c0ff5

Please sign in to comment.