33 lines
976 B
Makefile
33 lines
976 B
Makefile
COMPETITION = competition.yml
|
|
CATEGORIES != yq '.Categories | keys.[]' $(COMPETITION)
|
|
PEOPLE != yq '.People.[]' $(COMPETITION)
|
|
FIND_CAT_CHALLS = $(let CAT,$1,$(shell yq ".Categories.$(CAT).Challenges.[]" $(COMPETITION)))
|
|
|
|
CHALLS=$(foreach CAT,\
|
|
$(CATEGORIES),\
|
|
$(foreach CHALL,\
|
|
$(patsubst "%",%,$(call FIND_CAT_CHALLS,$(CAT))),\
|
|
$(patsubst "%",%,$(CAT))/$(CHALL)\
|
|
)\
|
|
)
|
|
|
|
.PHONY: printVerifiedFlags
|
|
printVerifiedFlags: $(CHALLS)
|
|
find . -name 'Questions.yml' \
|
|
| xargs -n1 yq -c '.Questions.[].Question | select((.VerifiedBy != null) and (.Submitted == false)) | (.Text, .Flag)'
|
|
|
|
.PHONY: lock
|
|
lock: $(CHALLS)
|
|
find . -maxdepth 3 -type d -name files -exec chmod -R a-w {} \;
|
|
|
|
$(CHALLS):
|
|
mkdir -p $(foreach PERSON,$(patsubst "%",%,$(PEOPLE)),$(@)/$(PERSON))
|
|
mkdir -p $(@)/files
|
|
find $(@) -type d -mindepth 1 -exec touch {}/.gitkeep \;
|
|
cp ./.Questions.yml $(@)/Questions.yml
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
chmod -R a+w .
|
|
rm -rf $(CATEGORIES)
|