Luis Figueiredo 8 years ago
parent
commit
4eaa3167ee

+ 0 - 15
.drone.yml

@@ -1,15 +0,0 @@
-workspace:
-  base: /go
-  path: src/simple-web
-
-pipeline:
-  test:
-    image: golang:1.8
-    commands:
-      - make backend
-
-  publish:
-    image: plugins/docker
-    repo: hexasoftare.com:5000/myapp
-    username: ${DOCKER_USERNAME}
-    password: ${DOCKER_PASSWORD}

+ 9 - 6
Makefile

@@ -1,6 +1,4 @@
 
-#@mkdir -o DIST/bin
-#@mkdir -o DIST/public
 
 all: backend frontend
 
@@ -10,11 +8,11 @@ docker: Dockerfile
 deploy: docker
 	docker push hexasoftware.com:5000/myapp
 
-backend: backend/src/simple-web/cmd/server/server.go 
+backend: distpath 
 	@echo "Building backend...  $(pwd)"
-	CGO_ENABLED=0 go build -o DIST/bin/server backend/src/simple-web/cmd/server/server.go
+	CGO_ENABLED=0 go build -o DIST/bin/server backend/src/simple-web/server/server.go
 
-frontend: frontend/web/package.json
+frontend: distpath 
 	@echo "Building frontend..."
 	# Frontend
 	@cd frontend/web;node build/build.js
@@ -23,6 +21,11 @@ test: backend
 	cd DIST;tmux split "DBHOST=localhost PORT=8080 DEVMODE=1 bin/server"
 	cd frontend/web; npm run dev
 
-.PHONY: all test clean
+distpath:
+	@mkdir -p DIST/bin
+	@mkdir -p DIST/public
+
+
+.PHONY: all test clean backend frontend
 
 

BIN
backend/pkg/linux_amd64/simple-web/core.a


BIN
backend/pkg/linux_amd64/simple-web/core/usersvc.a


+ 0 - 11
backend/src/hexasoftware/lib/prettylog/global/register.go

@@ -1,11 +0,0 @@
-package global
-
-import (
-	"hexasoftware/lib/prettylog"
-	"log"
-)
-
-func init() {
-	log.SetFlags(0)
-	log.SetOutput(prettylog.New())
-}

+ 0 - 55
backend/src/hexasoftware/lib/prettylog/prettylog.go

@@ -1,55 +0,0 @@
-package prettylog
-
-import (
-	"fmt"
-	"log"
-	"runtime"
-	"strings"
-	"time"
-)
-
-type PrettyLogWritter struct {
-	lastTime time.Time
-	counter  int64
-}
-
-func New() *PrettyLogWritter {
-	return &PrettyLogWritter{time.Now(), 0}
-}
-
-func (this *PrettyLogWritter) Write(b []byte) (int, error) {
-
-	/*{
-		for i := 0; i < 6; i++ {
-			ptr, _, _, _ := runtime.Caller(i)
-			fname := runtime.FuncForPC(ptr).Name()
-			fmt.Println("Stack:", fname)
-		}
-	}*/
-
-	ptr, _, line, _ := runtime.Caller(3)
-	tname := runtime.FuncForPC(ptr).Name()
-	li := strings.LastIndex(tname, "/")
-	fname := tname[li+1:]
-
-	timeDiff := time.Since(this.lastTime)
-
-	var fduration float64 = float64(timeDiff.Nanoseconds()) / 1000000.0
-
-	msg := fmt.Sprintf("[%d:\033[34m%s\033[0m (\033[33m%s:%d\033[0m) \033[90m+%.2f/ms\033[0m]: %s",
-		this.counter,
-		time.Now().Format("2006-01-02 15:04:05"),
-		fname,
-		line,
-		fduration,
-		string(b),
-	)
-	this.lastTime = time.Now()
-	this.counter++
-
-	return fmt.Print(msg)
-}
-
-func CreateLogger() *log.Logger {
-	return log.New(New(), "", 0)
-}

+ 0 - 1
backend/src/hexasoftware/x/hqi

@@ -1 +0,0 @@
-Subproject commit 02040cb96ee6e0d582770e600d77fdecb8e7c142

+ 0 - 11
backend/src/simple-web/cmd/server/server.go

@@ -1,11 +0,0 @@
-package main
-
-import (
-	_ "hexasoftware/lib/prettylog/global"
-	"simple-web/server"
-)
-
-func main() {
-
-	server.Start()
-}

+ 2 - 2
backend/src/simple-web/core/session.go

@@ -1,8 +1,8 @@
 package core
 
 import (
-	"hexasoftware/x/hqi"
-	"hexasoftware/x/hqi/drv/mgodrv"
+	"hxs/hqi"
+	"hxs/hqi/drv/mgodrv"
 	"simple-web/core/usersvc"
 
 	mgo "gopkg.in/mgo.v2-unstable"

+ 1 - 1
backend/src/simple-web/core/usersvc/service.go

@@ -2,7 +2,7 @@ package usersvc
 
 import (
 	"errors"
-	"hexasoftware/x/hqi"
+	"hxs/hqi"
 	"log"
 
 	"github.com/google/uuid"

+ 3 - 2
backend/src/simple-web/server/http.go

@@ -1,8 +1,9 @@
-package server
+package main
 
 import (
 	"encoding/json"
 	"fmt"
+	_ "hxs/prettylog/global"
 	"log"
 	"net/http"
 	"net/http/httputil"
@@ -50,7 +51,7 @@ func vserve() http.HandlerFunc {
 	}
 }
 
-func Start() {
+func main() {
 	// Do this in some cmd line
 	s := c.Session()
 	s.User().NewUser("admin", "Administration account", "admin@domain.tld", "1q2w3e")

+ 0 - 15
docker-compose.yml

@@ -1,15 +0,0 @@
-version: '2'
-services:
-  dev-myapp:
-    build: .
-    environment:
-      - DBHOST=dev-mongo
-    ports:
-      - "8080:8080"
-  dev-mongo:
-    image: "mongo"
-    ports:
-      - "27017:27017"
-    volumes:
-      - "/home/stdio/mongodb:/data/db"
-      

+ 1 - 1
frontend/web/src/App.vue

@@ -11,7 +11,7 @@
 			<div class="route-container">
 				<router-view></router-view>
 			</div>
-			<small>v3</small>
+			<small>v5</small>
 		</div>
 	</div>
 </template>