Mirror of Github Repo. https://github.com/flockingbird/roost
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=roost_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. seed:
  16. cat test/fixtures/input/basic_users.jsonl | ./bin/sink
  17. # CUSTOM BUILD RULES
  18. test: export APP_ENV=test
  19. test:
  20. $(CMD_PREFIX) ruby -I lib:test:. -e "Dir.glob('$(TEST_FILES_PATTERN)') { |f| require(f) }"
  21. lint:
  22. $(CMD_PREFIX) rubocop
  23. clean:
  24. docker stop $(CONTAINER_NAME)
  25. docker rm $(CONTAINER_NAME)
  26. run:
  27. parallel --line-buffer ::: "$(CMD_PREFIX) rackup --port=9292 config.ru" "$(CMD_PREFIX) rake run_processors"
  28. deploy:
  29. $(CMD_PREFIX) cap production deploy
  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:migrate
  35. $(CMD_PREFIX) rake db:create_projections
  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 parallel