Skip to content

Commit

Permalink
edit build script, and rice test
Browse files Browse the repository at this point in the history
  • Loading branch information
woong committed Jun 10, 2019
1 parent 350f9d4 commit cef4042
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
9 changes: 5 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ APP="dilog"
# OS별로 빌드함.
# assets 폴더의 모든 에셋을 빌드전에 assets_vfsdata.go 파일로 생성한다.
go run assets/asset_generate.go
rice embed-go

# OS별 필드
GOOS=linux GOARCH=amd64 go build -o ./bin/linux/${APP} dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go
GOOS=windows GOARCH=amd64 go build -o ./bin/windows/${APP}.exe dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go
GOOS=darwin GOARCH=amd64 go build -o ./bin/darwin/${APP} dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go
GOOS=linux GOARCH=amd64 go build -o ./bin/linux/${APP} dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go rice-box.go
GOOS=windows GOARCH=amd64 go build -o ./bin/windows/${APP}.exe dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go rice-box.go
GOOS=darwin GOARCH=amd64 go build -o ./bin/darwin/${APP} dilog.go struct.go dbapi.go network.go timecheck.go http.go templatefunc.go assets_vfsdata.go rice-box.go

# Github Release에 업로드 하기위해 압축
cd ./bin/linux/ && tar -zcvf ../${APP}_linux_x86-64.tgz . && cd -
Expand All @@ -18,4 +19,4 @@ cd ./bin/darwin/ && tar -zcvf ../${APP}_darwin_x86-64.tgz . && cd -
# 삭제
rm -rf ./bin/linux
rm -rf ./bin/windows
rm -rf ./bin/darwin
rm -rf ./bin/darwin
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0 h1:KkI6O9uMaQU3VEKaj01ulavtF7o1fWT7+pk/4voiMLQ=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b h1:4kg1wyftSKxLtnPAvcRWakIPpokB9w780/KwrNLnfPA=
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
Expand Down
43 changes: 43 additions & 0 deletions rice-box.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"time"

"github.com/GeertJohan/go.rice/embedded"
)

func init() {

// define files
file2 := &embedded.EmbeddedFile{
Filename: "dilog.html",
FileModTime: time.Unix(1560144273, 0),

Content: string("{{define \"dilog\" }}\n<!DOCTYPE html>\n<head>\n <title>dilog</title>\n <meta charset=\"utf-8\">\n <link rel=\"stylesheet\" href=\"/assets/bootstrap-4/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"/assets/css/dilog.css\">\n <link rel=\"icon\" type=\"image/png\" href=\"/assets/img/dilog.png\">\n</head>\n<body>\n<!--info-->\n<div class=\"info pl-5 pb-2 pt-1 text-secondary\">\n Info:\n {{if .Tool}}\n {{.Tool}}\n {{if .Project}}\n > {{.Project}}\n {{if .Slug}}\n > {{.Slug}}\n {{end}}\n {{end}}\n {{end}}\n</div>\n<!--searchbox-->\n<div class=\"container p-3\">\n <div class=\"row justify-content-center align-items-center p-3\">\n <form action=\"/search\" method=\"POST\" name=\"checkboxs\" class=\"editform text-center\">\n <div class=\"input-group\">\n <input class=\"form-control bg-dark text-light\" id=\"search\" placeholder=\"Search word..\" type=\"text\" maxlength=\"50\" size=50 name=\"searchword\" autofocus=\"autofocus\" value=\"{{.Searchword}}\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-dark border-light\" id=\"button\">Search</button>\n </div>\n </div>\n </form>\n </div>\n</div>\n\n<!--print log-->\n<div class=\"p-5\">\n {{if .Error}}\n <div class=\"text-danger text-center\">\n {{.Error}}\n </div>\n {{else if .Logs}}\n <div class=\"row text-warning mb-3\">\n <div class=\"col-lg-2\">Time</div>\n <div class=\"col-lg-1\">ID</div>\n <div class=\"col-lg-1\">Keep</div>\n <div class=\"col-lg-1\">IP</div>\n <div class=\"col-lg-1\">User</div>\n <div class=\"col-lg-1\">Tool</div>\n <div class=\"col-lg-1\">Project</div>\n <div class=\"col-lg-1\">Slug</div>\n <div class=\"col-lg-3\">Logs</div>\n </div>\n {{range .Logs}}\n <div class=\"row text-secondary mb-1\">\n <div class=\"col-lg-2\">{{.Time}}</div>\n <div class=\"col-lg-1\">{{.ID}}</div>\n <div class=\"col-lg-1\">{{.Keep}}</div>\n <div class=\"col-lg-1\">{{.Cip}}</div>\n <div class=\"col-lg-1\">{{.User}}</div>\n <div class=\"col-lg-1\"><a href=\"/search?tool={{.Tool}}&page=1\">{{.Tool}}</a></div>\n <div class=\"col-lg-1\"><a href=\"/search?tool={{.Tool}}&project={{.Project}}&page=1\" class=\"text-success\">{{.Project}}</a></div>\n <div class=\"col-lg-1\"><a href=\"/search?tool={{.Tool}}&project={{.Project}}&slug={{.Slug}}&page=1\" class=\"text-info\">{{.Slug}}</a></div>\n <div class=\"col-lg-3 text-white\">{{addLink .Log}}</div>\n </div>\n <hr/>\n {{end}}\n \n \n {{else}}\n <div class=\"text-warning text-center\">\n No Result.\n </div>\n {{end}}\n \n</div>\n\n<!--print page-->\n<div class=\"pages text-center m-5\">\n {{range .TotalPagenum}}\n <a href=\"/search?tool={{$.Tool}}&project={{$.Project}}&searchword={{$.Searchword}}&slug={{$.Slug}}&page={{.}}\" class=\"btn btn-dark btn-sm\">{{.}}</a>\n {{end}}\n</div>\n \n<footer class=\"footer text-center text-secondary\">\n © 2019 lazypic & digitalidea\n</footer>\n</body>\n<script src=\"/assets/bootstrap-4/js/bootstrap.min.js\"></script>\n</html>\n{{end}}"),
}

// define dirs
dir1 := &embedded.EmbeddedDir{
Filename: "",
DirModTime: time.Unix(1560144273, 0),
ChildFiles: []*embedded.EmbeddedFile{
file2, // "dilog.html"

},
}

// link ChildDirs
dir1.ChildDirs = []*embedded.EmbeddedDir{}

// register embeddedBox
embedded.RegisterEmbeddedBox(`assets/template`, &embedded.EmbeddedBox{
Name: `assets/template`,
Time: time.Unix(1560144273, 0),
Dirs: map[string]*embedded.EmbeddedDir{
"": dir1,
},
Files: map[string]*embedded.EmbeddedFile{
"dilog.html": file2,
},
})
}

0 comments on commit cef4042

Please sign in to comment.