This repository has been archived by the owner on Apr 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
123 lines (87 loc) · 3.43 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
include .Makefile.d/command.mk
## Developer Tasks
run: Procfile
$(POORMAN) start
docs: birding-dev
@PATH=$(VENDOR)/opt/python2.7/bin:$(PATH) $(MAKE) -C docs html
.PHONY: docs
flakes: pyflakes-command
@find *.py src -name '*.py' | xargs pyflakes
clean-data:
rm -fr $(VENDOR)/var/lib/elasticsearch
rm -fr $(VENDOR)/var/lib/kafka
rm -fr $(VENDOR)/var/lib/zookeeper
python = $(VENDOR)/opt/python2.7/bin/python
python: develop
@$(python)
test: develop flakes
$(python) setup.py nosetests --with-doctest
# Dump birding.yml from birding's resulting config dict.
config:
@$(python) -m birding.config --yaml
# Debug tool to view birding's resulting config dict.
config-dict:
@$(python) -m birding.config
publish: develop flakes
$(python) setup.py sdist --formats=bztar,zip upload -r $(PYPI_URL)
publish-readme: develop # Unless publishing, use this to update PyPI w/README.
$(python) setup.py register -r $(PYPI_URL)
publish-test: develop flakes
$(python) setup.py register -r $(PYPI_URL)
$(python) setup.py sdist --formats=bztar,zip upload -r $(PYPI_URL)
publish publish-readme: PYPI_URL = https://pypi.python.org/pypi
publish-test: PYPI_URL = https://testpypi.python.org/pypi
## Run Recipes w/Automated Requirements
include .Makefile.d/path.mk
include .Makefile.d/procfile.mk
include .Makefile.d/vendor.mk
include .Makefile.d/wait.mk
sparse := $(VENDOR)/opt/python2.7/bin/sparse
# If BIRDING_CONF is unset, use birding.yml in the root directory if it exists.
ifeq ("$(BIRDING_CONF)","")
ifneq ("$(wildcard $(PROJECT_ROOT)/birding.yml)","")
export BIRDING_CONF=$(PROJECT_ROOT)/birding.yml
endif
endif
Procfile: proc proc-zookeeper proc-kafka proc-streamparse proc-follow \
proc-elasticsearch
.PHONY: Procfile
run: vendor-poorman
run: POORMAN := $(VENDOR)/usr/bin/poorman
# Add run dependencies to reduce race between processes.
run: vendor-kafka vendor-python2.7
# Ensure twitter credentials are in place.
run: run-twitter
run-twitter: birding-dev
@echo Running twitter command to see if OAuth established ...
$(VENDOR)/opt/python2.7/bin/twitter
run-zookeeper: vendor-kafka
$(DIR)/bin/zookeeper-server-start.sh \
$(DIR)/config/birding-zookeeper.properties
run-kafka: vendor-kafka wait-tcp-2181
$(wrapper) $(DIR)/bin/kafka-server-start.sh \
$(DIR)/config/birding-kafka.properties
run-zookeeper run-kafka: DIR := $(VENDOR)/opt/kafka
# Sending kafka SIGKILL is dramatic, but it does not exit if zookeeper is gone.
run-kafka: wrapper := .Makefile.d/bin/run-then-sigkill
run-elasticsearch: vendor-elasticsearch
$(VENDOR)/usr/bin/elasticsearch -Des.logger.level=INFO
run-streamparse: $(sparse) wait-tcp-9092 wait-tcp-9200
$(KAFKA_DIR)/bin/kafka-topics.sh --create --zookeeper localhost:2181 \
--replication-factor 1 --partitions 1 --topic tweet ; true # KAFKA-2154
PATH=$(VENDOR)/opt/python2.7/bin:$(PATH) $(sparse) run
run-streamparse: KAFKA_DIR := $(VENDOR)/opt/kafka
run-follow: birding-dev wait-tcp-9092
$(VENDOR)/opt/python2.7/bin/python2.7 -m birding.follow
$(sparse): .develop
birding-dev: .develop
.PHONY: birding-dev
develop: .develop
.develop: virtualenvs/birding.txt Makefile setup.py
$(VENDOR)/opt/python2.7/bin/pip install sphinx sphinx-autobuild
$(VENDOR)/opt/python2.7/bin/pip install -r $<
$(VENDOR)/opt/python2.7/bin/python2.7 setup.py develop
@touch $@
# Reinstall dependencies if Python goes missing or is reinstalled.
.develop: $(VENDOR)/opt/python2.7/bin/python2.7
$(VENDOR)/opt/python2.7/bin/python2.7: python2.7-command vendor-python2.7