forked from AMDmi3/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced Makefile and narrowed down version in package.json.
- Loading branch information
Showing
6 changed files
with
149 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,143 @@ | ||
NODE?= node | ||
SEARCH?= opening_hours | ||
## Variables {{{ | ||
SHELL ?= /bin/sh | ||
NODE ?= node | ||
SEARCH ?= opening_hours | ||
|
||
.PHONY : default check build clean test test-normal test-min diff-test diff-test-min download-dependencies release | ||
default: test | ||
WGET_OPTIONS ?= --no-verbose | ||
## }}} | ||
|
||
build: opening_hours.min.js | ||
.PHONY : default | ||
default: check | ||
|
||
download-dependencies: | ||
.PHONY : dependencies-get | ||
dependencies-get: | ||
npm install | ||
|
||
clean: | ||
.PHONY : build | ||
build: opening_hours.min.js | ||
|
||
.PHONY : check | ||
check: check-diff-all | ||
|
||
.PHONY : benchmark | ||
benchmark: benchmark-opening_hours.js | ||
|
||
README.html: README.md | ||
|
||
.PHONY : release | ||
release: check-all | ||
editor package.json | ||
$(MAKE) test-package.json | ||
git commit --all | ||
git tag --sign --local-user=EE88E1F0 "v`json -f package.json version`" | ||
git push --tags | ||
npm publish | ||
$(MAKE) publish-website-on-all-servers | ||
|
||
.PHONY : clean | ||
clean: osm-tag-data-rm | ||
rm -f *.min.js | ||
rm -f export.*.json | ||
rm -f README.html | ||
rm -f taginfo_sources.json | ||
|
||
test-dev: diff-test | ||
## Publish {{{ | ||
|
||
fulltest: real_test test-dev diff-test-min benchmark | ||
.PHONY : publish-website-on-all-servers | ||
publish-website-on-all-servers: publish-website-on-ypid.de publish-website-on-openingh.openstreetmap.de | ||
|
||
test: opening_hours.js test.js | ||
${NODE} test.js "./$<" | ||
.PHONY : publish-website-on-openingh.openstreetmap.de | ||
publish-website-on-openingh.openstreetmap.de: | ||
ssh gauss.osm.de './update' | ||
|
||
test-min: opening_hours.min.js test.js | ||
${NODE} test.js "./$<" | ||
.PHONY : publish-website-on-ypid.de | ||
publish-website-on-ypid.de: | ||
ssh [email protected] './update' | ||
|
||
%.min.js: %.js | ||
uglifyjs "$<" --output "$@" --comments '/ypid\/opening_hours\.js/' --lint | ||
## }}} | ||
|
||
## command line programs {{{ | ||
.PHONY : run-regex_search | ||
run-regex_search: export.$(SEARCH).json interactive_testing.js regex_search.py | ||
$(NODE) ./regex_search.py "$<" | ||
|
||
.PHONY : run-interactive_testing | ||
run-interactive_testing: interactive_testing.js | ||
$(NODE) "$<" | ||
## }}} | ||
|
||
## software testing {{{ | ||
|
||
.PHONY : check-all | ||
check-all: check-package.json check-test check-diff-all osm-tag-data-update-check | ||
|
||
.SILENT: diff-test | ||
diff-test: opening_hours.js test.js | ||
.PHONY : check-diff-all | ||
check-diff-all: check-diff check-diff-opening_hours.min.js | ||
|
||
.PHONY : check-diff | ||
check-diff: check-diff-opening_hours.js | ||
|
||
.PHONY : check-test | ||
check-test: check-opening_hours.js | ||
|
||
# .PHONY : check-opening_hours.js | ||
## Does not work | ||
check-%.js: %.js test.js | ||
-$(NODE) test.js "./$<" | ||
|
||
.SILENT: check-diff-opening_hours.js check-diff-opening_hours.min.js | ||
check-diff-%.js: %.js test.js | ||
git checkout HEAD -- test.log | ||
# git checkout master -- test.log | ||
# git checkout 9f323b9d06720b6efffc7420023e746ff8f1b309 -- test.log | ||
${NODE} test.js 1> test.log 2>&1 || echo "Test results for $< are exactly the same as on developemt system. So far, so good ;)" | ||
$(NODE) test.js 1> test.log 2>&1 || echo "Test results for $< are exactly the same as on developemt system. So far, so good ;)" | ||
# git --no-pager diff --color-words test.log | ||
git --no-pager diff test.log | ||
|
||
.SILENT: diff-test-min | ||
diff-test-min: opening_hours.min.js test.js | ||
git checkout HEAD -- test.log | ||
${NODE} test.js "./$<" 1> test.log 2>&1 || echo "Test results for $< are exactly the same as on developemt system. So far, so good ;)" | ||
# git --no-pager diff --color-words test.log | ||
git --no-pager diff test.log | ||
.PHONY : osm-tag-data-check | ||
osm-tag-data-check: real_test.js opening_hours.js osm-tag-data-get-all | ||
$(NODE) "$<" | ||
|
||
.PHONY : osm-tag-data-update-check | ||
.SILENT : osm-tag-data-update-check | ||
osm-tag-data-update-check: | ||
-$(MAKE) --quiet osm-tag-data-update-all 2>/dev/null | ||
$(MAKE) --quiet osm-tag-data-check | ||
|
||
# .PHONY : benchmark | ||
benchmark-%.js: %.js benchmark.js | ||
$(NODE) ./benchmark.js "$<" | ||
|
||
.PHONY : check-package.json | ||
check-package.json: package.json | ||
pjv --warnings --recommendations --filename "$<" | ||
|
||
benchmark: opening_hours.js benchmark.js | ||
${NODE} benchmark.js | ||
## }}} | ||
|
||
real_test: opening_hours.js real_test.js all-osm-tags | ||
${NODE} real_test.js | ||
## OSM data from taginfo {{{ | ||
|
||
## See real_test.js | ||
real_test-stats: real_test.opening_hours.stats.csv | ||
${NODE} check_for_new_taginfo_data.js | ||
make clean | ||
make real_test | ||
.PHONY : osm-tag-data-gen-stats | ||
osm-tag-data-gen-stats: real_test.opening_hours.stats.csv osm-tag-data-update-check | ||
|
||
.PHONY : regex_search | ||
regex_search: export.$(SEARCH).json interactive_testing.js | ||
./regex_search.py $< | ||
.PHONY : osm-tag-data-rm | ||
osm-tag-data-rm: | ||
rm -f export.*.json | ||
|
||
interactive_testing: interactive_testing.js | ||
${NODE} interactive_testing.js | ||
.PHONY : osm-tag-data-update-all | ||
osm-tag-data-update-all: | ||
$(NODE) ./check_for_new_taginfo_data.js | ||
$(MAKE) osm-tag-data-rm | ||
$(MAKE) osm-tag-data-get-all | ||
|
||
all-osm-tags: export.opening_hours.json export.lit.json export.opening_hours\:kitchen.json export.opening_hours\:warm_kitchen.json export.smoking_hours.json export.collection_times.json export.service_times.json export.fee.json export.happy_hours.json export.delivery_hours.json export.opening_hours\:delivery.json | ||
.PHONY : osm-tag-data-get-all | ||
osm-tag-data-get-all: export.opening_hours.json export.lit.json export.opening_hours\:kitchen.json export.opening_hours\:warm_kitchen.json export.smoking_hours.json export.collection_times.json export.service_times.json export.fee.json export.happy_hours.json export.delivery_hours.json export.opening_hours\:delivery.json | ||
|
||
export.%.json: | ||
wget -O "$(shell echo "$@" | sed 's/\\//g' )" "http://taginfo.openstreetmap.org/api/4/key/values?key=$(shell echo "$@" | sed 's/^export\.\(.*\)\.json/\1/;s/\\//g' )" | ||
wget $(WGET_OPTIONS) --output-document="$(shell echo "$@" | sed 's/\\//g' )" "http://taginfo.openstreetmap.org/api/4/key/values?key=$(shell echo "$@" | sed 's/^export\.\(.*\)\.json/\1/;s/\\//g' )" 2>&1 | ||
## }}} | ||
|
||
release: clean fulltest | ||
editor package.json | ||
git commit --all | ||
git tag --sign --local-user=EE88E1F0 "v`npm view opening_hours version |head --lines 1`" | ||
git push --tags | ||
npm publish | ||
|
||
README.html: README.md | ||
%.min.js: %.js | ||
uglifyjs "$<" --output "$@" --comments '/ypid\/opening_hours\.js/' --lint | ||
|
||
%.html: %.md | ||
pandoc --from markdown_github --to html --standalone $< --output $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters