2017-04-24 09:20:46 -06:00
|
|
|
ROUTE_ASSET=routes/bindata_assetfs.go
|
|
|
|
ROUTE_FILES=public/index.html public/app.js public/paste.sh public/style.css
|
|
|
|
|
2018-02-15 09:11:52 -07:00
|
|
|
VENDOR_FILES=$(wildcard vendor/*)
|
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
SOURCE=./*.go routes/*.go
|
|
|
|
BINARY=paste
|
|
|
|
|
|
|
|
all: $(BINARY)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(BINARY) $(ROUTE_ASSET) $(ROUTE_FILES)
|
|
|
|
|
2018-02-15 08:01:35 -07:00
|
|
|
run: $(BINARY)
|
|
|
|
./$(BINARY) -vv serve
|
2017-05-22 11:13:47 -06:00
|
|
|
|
2018-02-15 09:11:52 -07:00
|
|
|
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES)
|
2017-04-24 09:20:46 -06:00
|
|
|
go build
|
|
|
|
|
|
|
|
$(ROUTE_ASSET): $(ROUTE_FILES)
|
|
|
|
export PATH=$$GOPATH/bin:$$PATH; cd routes; go-bindata-assetfs -pkg routes -prefix ../ ../public/
|
|
|
|
|
|
|
|
public/index.html: assets/index.html assets/ui/*
|
|
|
|
cd assets; \
|
|
|
|
(sed '/INSERT_TEMPLATES/Q' index.html; \
|
|
|
|
for f in ui/*.html; \
|
|
|
|
do echo "<script id='$$f' type='text/ng-template'>"; \
|
|
|
|
html-minifier --minify-css --collapse-whitespace $$f; \
|
|
|
|
echo '</script>'; \
|
|
|
|
done; \
|
|
|
|
sed '1,/INSERT_TEMPLATES/d;/REMOVE_ASSET_START/,/REMOVE_ASSET_END/d' index.html) \
|
2017-10-13 16:41:48 -06:00
|
|
|
| html-minifier --minify-css --collapse-whitespace > ../public/index.html
|
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
public/app.js: assets/lib.js assets/app.js
|
|
|
|
cat assets/lib.js assets/app.js | uglifyjs > public/app.js
|
2017-10-13 16:41:48 -06:00
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
public/paste.sh: assets/paste.sh
|
|
|
|
cp assets/paste.sh public/paste.sh
|
2017-10-13 16:41:48 -06:00
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
public/style.css: assets/*.css
|
|
|
|
cleancss assets/*.css > public/style.css
|
|
|
|
|
2018-02-15 09:11:52 -07:00
|
|
|
deploy: $(SOURCE) $(ROUTE_ASSET)
|
2017-04-24 09:20:46 -06:00
|
|
|
cd debian && make && make deploy
|
|
|
|
|
2018-02-15 08:01:35 -07:00
|
|
|
.PHONEY: clean deploy run
|