⌚ OpenOpeningstijden main server application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. CMD_PREFIX=bundle exec
  2. CONTAINER_NAME=hours_development
  3. TEST_FILES_PATTERN ?= **/*_test.rb
  4. # You want latexmk to *always* run, because make does not have all the info.
  5. # Also, include non-file targets in .PHONY so they are run regardless of any
  6. # file of the given name existing.
  7. .PHONY: all test lint clean setup ruby packages preprocess run
  8. # The first rule in a Makefile is the one executed by default ("make"). It
  9. # should always be the "all" rule, so that "make" and "make all" are identical.
  10. all: test lint
  11. db:
  12. make _docker-install || make _docker-start
  13. make _wait
  14. make _db-setup
  15. # CUSTOM BUILD RULES
  16. test: export APP_ENV=test
  17. test:
  18. $(CMD_PREFIX) ruby -I lib:test:. -e "Dir.glob('$(TEST_FILES_PATTERN)') { |f| require(f) }"
  19. lint:
  20. $(CMD_PREFIX) rubocop
  21. clean:
  22. docker stop hours_development
  23. docker rm hours_development
  24. run:
  25. $(CMD_PREFIX) foreman start
  26. import:
  27. ./bin/openaddr2copy < /mnt/sda/OSM/openaddr/nl/countrywide.csv | psql postgresql://$(DB_USER):$(DB_PASSWORD)@$(DB_HOST):$(DB_PORT)/$(DB_NAME) -c "COPY query_addresses FROM STDIN DELIMITER AS ',' CSV HEADER"
  28. osmium tags-filter /mnt/sda/OSM/netherlands-latest.osm.pbf n/amenity=cafe,bar,restaurant,biergarten,fast_food,food_court,ice_cream,pub n/shop n/amenity=bicycle_parking,parking,parking_entrance --output-format osm | osm2geojson | bin/sink
  29. _docker-start:
  30. @if [ -z $(docker ps --no-trunc | grep $(CONTAINER_NAME)) ]; then docker start $(CONTAINER_NAME); fi
  31. _db-setup:
  32. $(CMD_PREFIX) rake db:create
  33. $(CMD_PREFIX) rake db:event_store
  34. $(CMD_PREFIX) rake db:projections
  35. @if [ $(APP_ENV) = 'test' ]; then ./bin/seedaddr < test/fixtures/address_sample.csv; fi
  36. _wait:
  37. sleep 5
  38. ##
  39. # Set up the project for building
  40. setup: _ruby _packages _docker-install
  41. _docker-install:
  42. docker run -p 5432:5432 --name $(CONTAINER_NAME) -e POSTGRES_PASSWORD=$(DB_PASSWORD) -d mdillon/postgis
  43. _ruby:
  44. bundle install
  45. _packages:
  46. sudo apt install ruby