Skip to content

Commit

Permalink
Include static files with packr
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-brito committed Aug 31, 2019
1 parent 1e896e2 commit a9ac356
Show file tree
Hide file tree
Showing 1,238 changed files with 271 additions and 469,810 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

# Project files
gocity
coverage.txt
coverage.txt
/vendor
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: go

go: 1.x
go: 1.12.x

script:
- go mod download
- make test

after_success:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.12 as build
WORKDIR /app
ADD . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -mod vendor
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -ldflags="-w -s" -mod vendor

FROM alpine
COPY --from=build /app/gocity /bin/gocity
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test:
done

build-docker:
docker build -t rodrigobrito/gocity -f ./server/docker/Dockerfile .
docker build -t rodrigobrito/gocity .

deploy:
heroku container:push -a go-city web
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img width="500" src="https://raw.githubusercontent.com/rodrigo-brito/gocity/master/assets/logo.png" alt="GoCity" />
<img width="350" src="https://raw.githubusercontent.com/rodrigo-brito/gocity/master/handle/assets/logo.png" alt="GoCity" />

[![Build Status](https://travis-ci.org/rodrigo-brito/gocity.svg?branch=master)](https://travis-ci.org/rodrigo-brito/gocity)
[![codecov](https://codecov.io/gh/rodrigo-brito/gocity/branch/master/graph/badge.svg)](https://codecov.io/gh/rodrigo-brito/gocity)
Expand Down
38 changes: 19 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
module github.com/rodrigo-brito/gocity

require (
cloud.google.com/go v0.30.0
cloud.google.com/go v0.44.3
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 // indirect
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
github.com/gliderlabs/ssh v0.1.1 // indirect
github.com/go-chi/chi v4.0.1+incompatible
github.com/go-chi/cors v1.0.0
github.com/google/go-cmp v0.2.0 // indirect
github.com/googleapis/gax-go v2.0.0+incompatible // indirect
github.com/gobuffalo/logger v1.0.1 // indirect
github.com/gobuffalo/packr/v2 v2.6.0
github.com/google/go-cmp v0.3.1 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/karlseguin/ccache v2.0.2+incompatible
github.com/karlseguin/expect v1.0.1 // indirect
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e // indirect
github.com/mitchellh/go-homedir v1.0.0 // indirect
github.com/pelletier/go-buffruneio v0.2.0 // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
github.com/pkg/errors v0.8.1 // indirect
github.com/rogpeppe/go-internal v1.3.1 // indirect
github.com/sergi/go-diff v1.0.0 // indirect
github.com/sirupsen/logrus v1.3.0
github.com/sirupsen/logrus v1.4.2
github.com/src-d/gcfg v1.3.0 // indirect
github.com/stretchr/testify v1.2.2
github.com/tsuru/tsuru v0.0.0-20190213172318-ad6c1309d678 // indirect
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.20.0
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 // indirect
github.com/xanzy/ssh-agent v0.2.0 // indirect
go.opencensus.io v0.17.0 // indirect
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect
golang.org/x/net v0.0.0-20181005035420-146acd28ed58 // indirect
google.golang.org/api v0.0.0-20181021000519-a2651947f503 // indirect
google.golang.org/genproto v0.0.0-20181016170114-94acd270e44e // indirect
google.golang.org/grpc v1.15.0 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
golang.org/x/sys v0.0.0-20190830142957-1e83adbbebd0 // indirect
google.golang.org/api v0.9.0 // indirect
google.golang.org/appengine v1.6.2 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
google.golang.org/grpc v1.23.0 // indirect
gopkg.in/karlseguin/expect.v1 v1.0.1 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect
gopkg.in/src-d/go-git-fixtures.v3 v3.1.1 // indirect
gopkg.in/src-d/go-git.v4 v4.7.0
Expand Down
246 changes: 190 additions & 56 deletions go.sum

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions handle/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/json"
"fmt"
"net/http"
"path/filepath"
"time"

"github.com/gobuffalo/packr/v2"

"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/rodrigo-brito/gocity/analyzer"
Expand Down Expand Up @@ -93,14 +94,10 @@ func (h *AnalyzerHandle) Serve(port int) error {
router.Use(middlewares.APIHeader(fmt.Sprintf("%s/api", baseURL)))
router.Use(middleware.DefaultLogger)

staticPath, err := filepath.Abs("./assets")
if err != nil {
return err
}
box := packr.New("assets", "./assets")
fs := http.FileServer(box)

fs := http.FileServer(http.Dir(staticPath))
router.Handle("/*", fs)

router.Get("/api", h.Handler)
router.Get("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
8 changes: 8 additions & 0 deletions handle/handle-packr.go

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

31 changes: 0 additions & 31 deletions handle/proxy.go

This file was deleted.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
log.SetLevel(log.InfoLevel)

app := cli.NewApp()
app.Version = "1.0.1"
app.Version = "1.0.2"
app.Description = "Code City metaphor for visualizing Go source code in 3D"
app.Author = "Rodrigo Brito (https://github.com/rodrigo-brito)"

Expand Down
42 changes: 42 additions & 0 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions server/Caddyfile

This file was deleted.

2 changes: 0 additions & 2 deletions server/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions server/docker-compose.yml

This file was deleted.

6 changes: 0 additions & 6 deletions server/wedeploy.json

This file was deleted.

15 changes: 0 additions & 15 deletions vendor/cloud.google.com/go/AUTHORS

This file was deleted.

40 changes: 0 additions & 40 deletions vendor/cloud.google.com/go/CONTRIBUTORS

This file was deleted.

Loading

0 comments on commit a9ac356

Please sign in to comment.