2017-10-29 22:06:41 +00:00
|
|
|
install:
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Installing Go dependencies"
|
|
|
|
@cd backend && dep ensure
|
|
|
|
@echo "* Pre-building Go code"
|
|
|
|
@cd backend && go install ./...
|
|
|
|
@echo "* Installing JavaScript dependencies"
|
|
|
|
@cd frontend && npm install &> /dev/null
|
2017-10-29 22:06:41 +00:00
|
|
|
|
2017-11-07 22:25:25 +00:00
|
|
|
build: assets
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Building binary"
|
|
|
|
@go build -tags=binassets -o backend/build/cmdui backend/main.go
|
|
|
|
@echo "* Build complete!"
|
|
|
|
@echo "* Binary is located at backend/build/cmdui"
|
2017-11-07 22:25:25 +00:00
|
|
|
|
|
|
|
build_linux: assets build_docker
|
|
|
|
|
|
|
|
build_docker:
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Preparing Docker image"
|
|
|
|
@cd backend && docker build . -t cmdui:build &>/dev/null
|
|
|
|
@echo "* Building Linux binary"
|
|
|
|
@cd backend && docker run -i -v ${PWD}/backend/build:/build cmdui:build \
|
|
|
|
go build -tags=binassets -o /build/cmdui_linux main.go \
|
|
|
|
&>/dev/null
|
|
|
|
@echo "* Creating GZIP archive"
|
|
|
|
@gzip -kf backend/build/cmdui_linux
|
|
|
|
@echo "* Build complete!"
|
|
|
|
@echo "* Binary: backend/build/cmdui_linux"
|
|
|
|
@echo "* GZIP: backend/build/cmdui_linux.gz"
|
2017-11-07 22:25:25 +00:00
|
|
|
|
|
|
|
assets:
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Compiling asset files"
|
|
|
|
@cd frontend && npm run build &>/dev/null
|
|
|
|
@echo "* Building embedded assets file"
|
|
|
|
@go-bindata-assetfs \
|
2017-10-29 22:06:41 +00:00
|
|
|
-o=backend/api/assets/bindata_assetfs.go \
|
|
|
|
-pkg=assets \
|
|
|
|
-prefix=frontend/build \
|
2017-11-07 23:36:59 +00:00
|
|
|
frontend/build/... \
|
|
|
|
&>/dev/null
|
2017-10-29 22:06:41 +00:00
|
|
|
|
2017-11-07 22:25:25 +00:00
|
|
|
clean:
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Removing build artefacts"
|
|
|
|
@rm -rf frontend/build
|
|
|
|
@rm -rf backend/build
|
|
|
|
@rm -f backend/api/assets/bindata_assetfs.go
|
2017-11-07 20:08:44 +00:00
|
|
|
|
2017-11-06 23:12:06 +00:00
|
|
|
create_db:
|
2017-11-07 23:36:59 +00:00
|
|
|
@echo "* Creating a blank database"
|
|
|
|
@sqlite3 backend/data/cmdui.db < backend/schema_sqlite.sql
|
|
|
|
@echo "* Here it is: backend/data/cmdui.db"
|
2017-11-06 23:12:06 +00:00
|
|
|
|
2017-10-29 22:06:41 +00:00
|
|
|
cloc:
|
2017-11-07 23:36:59 +00:00
|
|
|
@cloc --exclude-dir=vendor,build,node_modules .
|