Skip to content

Commit

Permalink
Make current git hash available at /version . Closes #21.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed May 12, 2016
1 parent 78b0ceb commit fdcf9ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/files/version
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pre-commit: lint build test
travis: pre-commit

.PHONY: deploy
deploy: check
deploy: check version
aedeploy gcloud preview app deploy app.yaml --promote

CURRENT_DIR = "$(shell pwd)"
Expand All @@ -38,6 +38,12 @@ else
@echo "Actual: ${CURRENT_DIR}"
endif

# Version file.

.PHONY: version
version:
git rev-parse HEAD > ./files/version

# Google Cloud Datastore Emulator

GCD_NAME = gcd-grpc-1.0.0
Expand All @@ -53,7 +59,7 @@ ${DATABASE_TESTING_FOLDER}/gcd/gcd.sh:
# Testing

.PHONY: serve
serve: check get-datastore-emulator
serve: check get-datastore-emulator version
go run *.go -local

.PHONY: test
Expand Down
2 changes: 2 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ api_version: go1
handlers:
- url: /
script: _go_app
- url: /version
script: _go_app
- url: /favicon.ico
script: _go_app
- url: /static/.*
Expand Down
1 change: 1 addition & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func main() {

staticHandler := http.FileServer(http.Dir("files"))
http.Handle("/", staticHandler)
http.Handle("/version", staticHandler)
http.Handle("/favicon.ico", staticHandler)
http.Handle("/static/", staticHandler)

Expand Down

0 comments on commit fdcf9ba

Please sign in to comment.