-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (52 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
74 lines (52 loc) · 1.42 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Makefile for has
# https://github.com/kdabir/has
# Sadly, longopts like --verbose are not working on MacOS for cp, mkdir and rm
# PREFIX is an environment variable.
# Use default value if not set.
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
test: unit-test intg-test
unit-test:
bats tests/unit/unit-tests.bats
bats tests/unit/with-mocks.bats
intg-test:
bats -t tests/intg/intg-tests.bats
has :
# ensure 'has' in repo
git checkout --force -- has
# install 'has' in specified directory
install : has
chmod 755 has && \
mkdir -v -p $(DESTDIR)$(PREFIX)/bin && \
cp -v has $(DESTDIR)$(PREFIX)/bin/has
# update: has
update : update-fetch has
update-fetch : update-force
# update repo from upstream
git fetch --verbose --force
update-force :
# remove local repo 'has' to force update
rm -f has
uninstall :
rm -f $(DESTDIR)$(PREFIX)/bin/has
.PHONY: test install uninstall update
CONTAINERS = ubuntu alpine
.PHONY: docker-test
docker-test:
@for c in $(CONTAINERS); do \
$(MAKE) docker-test-$$c; \
done
.PHONY: docker-test-%
docker-test-%:
docker build -t test-image:$* -f tests/to-fix/containers/$*.Dockerfile .
docker run --rm \
-v $(PWD):/workspace \
-w /workspace \
test-image:$* \
bash -c "make test || bats -t ./tests/to-fix/test_all_packages.bats || true"
list:
@grep -o "^ \\+[a-zA-Z0-9_|-]\\+)" has | grep -o "[a-zA-Z0-9_|-]\\+" | tr "|" "\\n" | sort -f | sed '1,3d'
check:
@shellcheck has
.PHONY: check