1
1
shellcheck :
2
2
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$? ) ,127)
3
3
ifeq ($(shell uname) ,Darwin)
4
- brew install shellcheck
4
+ brew install shellcheck
5
5
else
6
- sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
7
- sudo apt-get update && sudo apt-get install -y shellcheck
6
+ sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
7
+ sudo apt-get update -qq && sudo apt-get install -qq -y shellcheck
8
8
endif
9
9
endif
10
10
11
11
bats :
12
+ ifeq ($(shell bats > /dev/null 2>&1 ; echo $$? ) ,127)
13
+ ifeq ($(shell uname) ,Darwin)
12
14
git clone https://github.com/sstephenson/bats.git /tmp/bats
13
15
cd /tmp/bats && sudo ./install.sh /usr/local
14
16
rm -rf /tmp/bats
17
+ else
18
+ sudo add-apt-repository ppa:duggan/bats --yes
19
+ sudo apt-get update -qq && sudo apt-get install -qq -y bats
20
+ endif
21
+ endif
15
22
16
23
ci-dependencies : shellcheck bats
17
24
@@ -21,10 +28,14 @@ lint:
21
28
# SC2068: Double quote array expansions, otherwise they're like $* and break on spaces. - https://github.com/koalaman/shellcheck/wiki/SC2068
22
29
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
23
30
@echo linting...
24
- @$(QUIET ) find . -not -path ' */\.*' | xargs file | egrep " shell|bash" | awk ' { print $$1 }' | sed ' s/://g' | xargs shellcheck -e SC2046,SC2068,SC2086
31
+ @$(QUIET ) find ./ -maxdepth 1 -not -path ' */\.*' | xargs file | egrep " shell|bash" | awk ' { print $$1 }' | sed ' s/://g' | xargs shellcheck -e SC2046,SC2068,SC2086
25
32
26
33
unit-tests :
27
34
@echo running unit tests...
28
- @$(QUIET ) bats tests/unit
35
+ @$(QUIET ) bats tests
36
+
37
+ setup :
38
+ bash tests/setup.sh
39
+ $(MAKE ) ci-dependencies
29
40
30
- test : ci-dependencies lint unit-tests
41
+ test : setup lint unit-tests
0 commit comments