This repository was archived by the owner on May 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 1.47 KB
/
Copy pathMakefile
File metadata and controls
60 lines (47 loc) · 1.47 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=mahout_pg
TEST_FILES_PATTERN ?=
# 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
# CUSTOM BUILD RULES
db:
make _docker-install || make _docker-start
make _wait
make _db-setup
make seed
#test: export RAILS_ENV=test
test:
$(CMD_PREFIX) rails test $(TEST_FILES_PATTERN)
$(CMD_PREFIX) rails test:system $(TEST_FILES_PATTERN)
lint:
$(CMD_PREFIX) rubocop
clean:
docker stop $(CONTAINER_NAME)
docker rm $(CONTAINER_NAME)
run:
$(CMD_PREFIX) rails server
seed:
$(CMD_PREFIX) rails db:seed
_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:event_store
$(CMD_PREFIX) rake db:projections
@if [ $(APP_ENV) = 'test' ]; then ./bin/seedaddr < test/fixtures/address_sample.csv; fi
_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