forked from RailsEventStore/rails_event_store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (79 loc) · 3.81 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
UPSTREAM_REV = `git rev-parse upstream/master`
ORIGIN_REV = `git rev-parse origin/master`
CURRENT_REV = `git rev-parse HEAD`
RES_VERSION ?= $(shell cat RES_VERSION)
NIX_TYPE = $(shell uname -s)
GEMS = aggregate_root \
bounded_context \
ruby_event_store \
ruby_event_store-rom \
rails_event_store \
rails_event_store_active_record \
rails_event_store_active_record-legacy \
rails_event_store-browser \
rails_event_store-rspec
ifeq ($(NIX_TYPE),Linux)
SED_OPTS = -i
endif
ifeq ($(NIX_TYPE),Darwin)
SED_OPTS = -i ""
endif
$(addprefix install-, $(GEMS)):
@make -C $(subst install-,,$@) install
$(addprefix reinstall-, $(GEMS)):
@make -C $(subst reinstall-,,$@) reinstall
$(addprefix test-, $(GEMS)):
@make -C $(subst test-,,$@) test
$(addprefix mutate-, $(GEMS)):
@make -C $(subst mutate-,,$@) mutate
$(addprefix build-, $(GEMS)):
@make -C $(subst build-,,$@) build
$(addprefix push-, $(GEMS)):
@make -C $(subst push-,,$@) push
$(addprefix clean-, $(GEMS)):
@make -C $(subst clean-,,$@) clean
git-check-clean:
@git diff --quiet --exit-code
git-check-committed:
@git diff-index --quiet --cached HEAD
git-tag:
@git tag -m "Version v$(RES_VERSION)" v$(RES_VERSION)
@git push origin master --tags
git-rebase-from-upstream:
@git remote remove upstream > /dev/null 2>&1 || true
@git remote add upstream [email protected]:RailsEventStore/rails_event_store.git
@git fetch upstream master
@git rebase upstream/master
@git push origin master
set-version: git-check-clean git-check-committed
@echo $(RES_VERSION) > RES_VERSION
@find . -name version.rb -exec sed $(SED_OPTS) "s/\(VERSION = \)\(.*\)/\1\"$(RES_VERSION)\"/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('ruby_event_store', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('ruby_event_store-rom', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('rails_event_store_active_record', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('rails_event_store_active_record-legacy', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('aggregate_root', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('bounded_context', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('rails_event_store', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('rails_event_store-browser', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@find . -name *.gemspec -exec sed $(SED_OPTS) "s/\('rails_event_store-rspec', \)\(.*\)/\1'= $(RES_VERSION)'/" {} \;
@git add -A **/*.gemspec **/version.rb RES_VERSION
@git commit -m "Version v$(RES_VERSION)"
install: $(addprefix install-, $(GEMS)) ## Install all dependencies
reinstall: $(addprefix reinstall-, $(GEMS)) ## Reinstall (with new resolve) dependencies
test: $(addprefix test-, $(GEMS)) ## Run all unit tests
mutate: $(addprefix mutate-, $(GEMS)) ## Run all mutation tests
build: $(addprefix build-, $(GEMS)) ## Build all gem packages
push: $(addprefix push-, $(GEMS)) ## Push all gem packages to RubyGems
clean: $(addprefix clean-, $(GEMS)) ## Remove all previously built packages
release: git-check-clean git-check-committed install test git-tag clean build push ## Make a new release on RubyGems
@echo Released v$(RES_VERSION)
rebase: git-rebase-from-upstream
@echo "Rebased with upstream/master"
@echo " upstream/master at $(UPSTREAM_REV)"
@echo " origin/master at $(ORIGIN_REV)"
@echo " current branch at $(CURRENT_REV)"
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
.DEFAULT_GOAL := help