Browse Source

added Makefile

dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 8 years ago
parent
commit
90d9d383ff
  1. 22
      .travis.yml
  2. 27
      Makefile
  3. 2
      handlers/handlers.go
  4. 8
      handlers/tmpls/tmpls.go
  5. 9
      store/store.go

22
.travis.yml

@ -1,10 +1,12 @@
language: go matrix:
go: include:
- 1.9.2 language: go
before_install: go:
- go get github.com/mattn/goveralls - 1.9.2
script: script:
- go get github.com/mjibson/esc - make
- go generate ./... language: node_js
- go test -v ./... node_js:
- goveralls -service=travis-ci - "9"
script:
- make buildNodeFrontend

27
Makefile

@ -0,0 +1,27 @@
all: getCMDDependencies embedFrontend getGoDependencies test uploadCoveralls
test:
go test -v ./...
buildNodeFrontend:
@cd static && yarn install
@cd static && yarn build
embedFrontend:
@cd handlers/tmpls && esc -o tmpls.go -pkg tmpls -include ^*\.tmpl .
@cd handlers && esc -o static.go -pkg handlers -prefix ../static/build ../static/build
getCMDDependencies:
go get -v github.com/mattn/goveralls
go get -v github.com/mjibson/esc
go get -v github.com/mitchellh/gox
getGoDependencies:
go get -v ./...
build:
@mkdir releases
gox -output="releases/{{.Dir}}_{{.OS}}_{{.Arch}}"
uploadCoveralls:
goveralls -service=travis-ci

2
handlers/handlers.go

@ -1,6 +1,4 @@
// Package handlers provides the http functionality for the URL Shortener // Package handlers provides the http functionality for the URL Shortener
//go:generate esc -o static.go -pkg handlers -prefix ../static/build ../static/build
//go:generate esc -o tmpls/tmpls.go -pkg tmpls -include ^*\.tmpl -prefix tmpls tmpls
package handlers package handlers
import ( import (

8
handlers/tmpls/tmpls.go

@ -1,4 +1,4 @@
// Code generated by "esc -o tmpls/tmpls.go -pkg tmpls -include ^*\.tmpl -prefix tmpls tmpls"; DO NOT EDIT. // Code generated by "esc -o tmpls.go -pkg tmpls -include ^*\.tmpl ."; DO NOT EDIT.
package tmpls package tmpls
@ -191,9 +191,9 @@ func FSMustString(useLocal bool, name string) string {
var _escData = map[string]*_escFile{ var _escData = map[string]*_escFile{
"/token.tmpl": { "/token.tmpl": {
local: "tmpls/token.tmpl", local: "token.tmpl",
size: 506, size: 506,
modtime: 1510047272, modtime: 1510088653,
compressed: ` compressed: `
H4sIAAAAAAAC/2RRwW7qMBC8R8o/7PMFkEjyeqtoHAml9NoeQCpHx16RFY6dJptEFeLfqwCl0M7FMzvr H4sIAAAAAAAC/2RRwW7qMBC8R8o/7PMFkEjyeqtoHAml9NoeQCpHx16RFY6dJptEFeLfqwCl0M7FMzvr
ka1J/z2/5uvt2wpKrmwWBul4glVuJwU6kYXBOENlsjAAAEgrZAW6VE2LLMVm/RI9ijvPqQql6AmH2jcs ka1J/z2/5uvt2wpKrmwWBul4glVuJwU6kYXBOENlsjAAAEgrZAW6VE2LLMVm/RI9ijvPqQql6AmH2jcs
@ -206,6 +206,6 @@ tr6DgayFAqFBQw1qRpMmZ/ey2uqGar6oEQM544fY1+iwiQ21tWJdrnp0PHU4QN617Kuznni37LjMlbWF
"/": { "/": {
isDir: true, isDir: true,
local: "tmpls", local: "",
}, },
} }

9
store/store.go

@ -20,11 +20,10 @@ type Store struct {
// Entry is the data set which is stored in the DB as JSON // Entry is the data set which is stored in the DB as JSON
type Entry struct { type Entry struct {
URL string URL string
VisitCount int VisitCount int
RemoteAddr string `json:",omitempty"` RemoteAddr string `json:",omitempty"`
CreatedOn time.Time CreatedOn, LastVisit time.Time
LastVisit time.Time
} }
// ErrNoEntryFound is returned when no entry to a id is found // ErrNoEntryFound is returned when no entry to a id is found

Loading…
Cancel
Save