-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackpack.sh
More file actions
executable file
·136 lines (118 loc) · 2.77 KB
/
backpack.sh
File metadata and controls
executable file
·136 lines (118 loc) · 2.77 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/env bash
#shellcheck disable=2215
cd "$(realpath "$(dirname "$0")")" &&
source bindle/project.sh
if [ $? -ne 0 ]; then
exit 1
fi
shadow-cljs() {
lein-dev trampoline run -m shadow.cljs.devtools.cli "$@"
}
## clean:
## Cleans up the compiled and generated sources
clean() {
stop
lein-clean
}
## lint:
lint() {
-lint
}
## deps:
## Installs all required dependencies for Clojure and ClojureScript
deps() {
-deps "$@"
}
## docs:
## Generate api documentation
docs() {
lein-docs
}
## stop:
## Stops shadow-cljs and karma
stop() {
echo-message 'Stopping'
shadow-cljs stop &>/dev/null
pkill -f 'karma ' &>/dev/null
}
## test:
## args: [-r]
## Runs the Clojure unit tests
## [-r] Watches tests and source files for changes, and subsequently re-evaluates
test() {
echo-message 'In the animal kingdom, the rule is, eat or be eaten.'
-test-clj "$@"
}
## test-cljs:
## args: [-r|--refresh|--watch] [-n|--node|-b|--browser] <focus>
## Runs the ClojureScript unit tests using Kaocha
## [-r|--refresh|--watch] Watches tests and source files for changes, and subsequently re-evaluates
## [-n|--node] Executes the tests targeting Node.js (default)
## [-b|--browser] Compiles the tests for execution within a browser
## <focus> Suite/namespace/var to focus on
test-cljs() {
-test-cljs "$@"
}
## test-shadow:
## args: [-r] [-k|-n|-b]
## Runs the ClojureScript unit tests using shadow-cljs and
## [-r] Watches tests and source files for changes, and subsequently re-evaluates with node
## [-k] Executes the tests targeting the browser running in karma (default)
## [-n] Executes the tests targeting Node.js
## [-b] Watches and compiles tests for execution within a browser
test-shadow() {
-test-shadow-cljs "$@"
}
## snapshot:
## args: [-l]
## Pushes a snapshot to Clojars
## [-l] local
snapshot() {
-snapshot "$@"
}
## release:
## Pushes a release to Clojars
release() {
-release
}
compare-file-from-master() {
local branch
if [[ -n $CIRCLE_BRANCH ]]; then
branch=$CIRCLE_BRANCH
else
branch=$(git rev-parse --abbrev-ref HEAD)
fi
git --no-pager diff --name-only "$branch..origin/master" -- "$1"
}
check-docs() {
local changelog_changed
changelog_changed=$(compare-file-from-master CHANGELOG.md)
abort-on-error
local version_changed
version_changed=$(compare-file-from-master VERSION)
abort-on-error
echo "$changelog_changed"
if [[ -n "$version_changed" && -z "$changelog_changed" ]]; then
echo-error "Version has changed without updating CHANGELOG.md"
exit 1
fi
}
## test-docs:
## Checks that the committed api documentation is up to date with the latest code
test-docs() {
check-docs
docs
echo-message 'Verifying animal facts...'
require-committed docs
}
deploy() {
deploy-clojars
}
deploy-snapshot() {
deploy-clojars
}
## outdated:
outdated() {
-outdated
}
script-invoke "$@"