TranslateProject/Makefile

41 lines
1.2 KiB
Makefile
Raw Normal View History

2017-12-15 12:37:16 +08:00
RULES := rule-source-added \
rule-translation-requested \
rule-translation-completed \
rule-translation-revised \
rule-translation-published
.PHONY: check match $(RULES)
CHANGE_FILE := /tmp/changes
check: $(CHANGE_FILE)
echo 'PR #$(TRAVIS_PULL_REQUEST) Changes:'
cat $(CHANGE_FILE)
echo
echo 'Check for rules...'
2017-12-15 13:10:59 +08:00
make -k $(RULES) | grep '^Rule Matched: '
2017-12-15 12:37:16 +08:00
$(CHANGE_FILE):
2017-12-15 13:10:59 +08:00
git --no-pager diff $(TRAVIS_BRANCH) FETCH_HEAD --no-renames --name-status > $@
2017-12-15 12:37:16 +08:00
rule-source-added:
[[ $(shell grep '^A\s\+sources/' $(CHANGE_FILE) | wc -l) -ge 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-requested:
[[ $(shell grep '^M\s\+sources/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-completed:
[[ $(shell grep '^D\s\+sources/' $(CHANGE_FILE) | wc -l) = 1 ]]
[[ $(shell grep '^A\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-revised:
[[ $(shell grep '^M\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-published:
[[ $(shell grep '^D\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
[[ $(shell grep '^A\s\+published/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'