From 209230dfd39522e90a6a08c9c63301f26d151769 Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Mon, 24 Nov 2014 12:58:14 +0000 Subject: [PATCH 1/4] Do not include files ignored by Git in compiled assets --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 23b663a..37ecb0d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ dev: dev-assets @echo "You can now execute ./pgweb" assets: - go-bindata $(BINDATA) -ignore=\\.gitignore -ignore=\\.DS_Store -ignore=\\.gitkeep static/... + go-bindata $(BINDATA) $(shell git ls-files -io --exclude-standard static/ | awk '{ gsub(/[.]/, "[.]"); printf "%s", " -ignore=" $$0 }') \ + -ignore=[.]gitignore -ignore=[.]gitkeep static/... dev-assets: @$(MAKE) --no-print-directory assets BINDATA="-debug" From fbbcd0ad5834d28fcb7f27d9b060e77d34ec319f Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Wed, 26 Nov 2014 12:41:25 +0000 Subject: [PATCH 2/4] Move Git-ignored file list into variable Rename existing variable to better indicate its use. --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 37ecb0d..66473a7 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,14 @@ -BINDATA= +BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard static/ | awk '{ gsub(/[.]/, "[.]"); printf "%s", " -ignore=" $$0 }') dev: dev-assets godep go build @echo "You can now execute ./pgweb" assets: - go-bindata $(BINDATA) $(shell git ls-files -io --exclude-standard static/ | awk '{ gsub(/[.]/, "[.]"); printf "%s", " -ignore=" $$0 }') \ - -ignore=[.]gitignore -ignore=[.]gitkeep static/... + go-bindata $(BINDATA_OPTS) $(BINDATA_IGNORE) -ignore=[.]gitignore -ignore=[.]gitkeep static/... dev-assets: - @$(MAKE) --no-print-directory assets BINDATA="-debug" + @$(MAKE) --no-print-directory assets BINDATA_OPTS="-debug" build: assets gox -osarch="darwin/amd64 darwin/386 linux/amd64 linux/386 windows/amd64 windows/386" -output="./bin/pgweb_{{.OS}}_{{.Arch}}" From 8f5f280597073ea79d6ab25d7deb269fe2771d23 Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Wed, 26 Nov 2014 12:44:01 +0000 Subject: [PATCH 3/4] Replace awk with sed `make` handles newlines already. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 66473a7..9ffa276 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard static/ | awk '{ gsub(/[.]/, "[.]"); printf "%s", " -ignore=" $$0 }') +BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard static/ | sed 's/^/-ignore=/;s/[.]/[.]/g') dev: dev-assets godep go build From bbdd0affbab493992b0b301f2efbac538782f9ef Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Wed, 26 Nov 2014 12:48:41 +0000 Subject: [PATCH 4/4] Pass asset directory as a dependency --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9ffa276..926dea3 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard static/ | sed 's/^/-ignore=/;s/[.]/[.]/g') +BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard $< | sed 's/^/-ignore=/;s/[.]/[.]/g') dev: dev-assets godep go build @echo "You can now execute ./pgweb" -assets: - go-bindata $(BINDATA_OPTS) $(BINDATA_IGNORE) -ignore=[.]gitignore -ignore=[.]gitkeep static/... +assets: static/ + go-bindata $(BINDATA_OPTS) $(BINDATA_IGNORE) -ignore=[.]gitignore -ignore=[.]gitkeep $<... dev-assets: @$(MAKE) --no-print-directory assets BINDATA_OPTS="-debug"