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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. CMD_PREFIX=bundle exec
  2. CONTAINER_NAME=mahout_pg
  3. TEST_FILES_PATTERN ?=
  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. # CUSTOM BUILD RULES
  12. db:
  13. make _docker-install || make _docker-start
  14. make _wait
  15. make _db-setup
  16. make seed
  17. #test: export RAILS_ENV=test
  18. test:
  19. $(CMD_PREFIX) rails test $(TEST_FILES_PATTERN)
  20. $(CMD_PREFIX) rails test:system $(TEST_FILES_PATTERN)
  21. lint:
  22. $(CMD_PREFIX) rubocop
  23. clean:
  24. docker stop $(CONTAINER_NAME)
  25. docker rm $(CONTAINER_NAME)
  26. run:
  27. $(CMD_PREFIX) rails server
  28. seed:
  29. $(CMD_PREFIX) rails db:seed
  30. _docker-start:
  31. @if [ -z $(docker ps --no-trunc | grep $(CONTAINER_NAME)) ]; then docker start $(CONTAINER_NAME); fi
  32. _db-setup:
  33. $(CMD_PREFIX) rake db:create
  34. $(CMD_PREFIX) rake db:event_store
  35. $(CMD_PREFIX) rake db:projections
  36. @if [ $(APP_ENV) = 'test' ]; then ./bin/seedaddr < test/fixtures/address_sample.csv; fi
  37. _wait:
  38. sleep 5
  39. ##
  40. # Set up the project for building
  41. setup: _ruby _packages _docker-install
  42. _docker-install:
  43. docker run -p 5432:5432 --name $(CONTAINER_NAME) -e POSTGRES_PASSWORD=$(DB_PASSWORD) -d mdillon/postgis
  44. _ruby:
  45. bundle install
  46. _packages:
  47. sudo apt install ruby