This repository was archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.54 KB
/
Makefile
File metadata and controls
60 lines (46 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CMD_PREFIX=bundle exec
CONTAINER_NAME=roost_development
TEST_FILES_PATTERN ?= **/*_test.rb
# You want latexmk to *always* run, because make does not have all the info.
# Also, include non-file targets in .PHONY so they are run regardless of any
# file of the given name existing.
.PHONY: all test lint clean setup ruby packages preprocess run
# The first rule in a Makefile is the one executed by default ("make"). It
# should always be the "all" rule, so that "make" and "make all" are identical.
all: test lint
db:
make _docker-install || make _docker-start
make _wait
make _db-setup
seed:
cat test/fixtures/input/basic_users.jsonl | ./bin/sink
# CUSTOM BUILD RULES
test: export APP_ENV=test
test:
$(CMD_PREFIX) ruby -I lib:test:. -e "Dir.glob('$(TEST_FILES_PATTERN)') { |f| require(f) }"
lint:
$(CMD_PREFIX) rubocop
clean:
docker stop $(CONTAINER_NAME)
docker rm $(CONTAINER_NAME)
run:
parallel --line-buffer ::: "$(CMD_PREFIX) rackup --port=9292 config.ru" "$(CMD_PREFIX) rake run_processors"
deploy:
$(CMD_PREFIX) cap production deploy
_docker-start:
@if [ -z $(docker ps --no-trunc | grep $(CONTAINER_NAME)) ]; then docker start $(CONTAINER_NAME); fi
_db-setup:
$(CMD_PREFIX) rake db:create
$(CMD_PREFIX) rake db:migrate
$(CMD_PREFIX) rake db:create_projections
_wait:
sleep 5
##
# Set up the project for building
setup: _ruby _packages _docker-install
_docker-install:
docker run -p 5432:5432 --name $(CONTAINER_NAME) -e POSTGRES_PASSWORD=$(DB_PASSWORD) -d mdillon/postgis
_ruby:
bundle install
_packages:
sudo apt install ruby parallel