-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec-runner.sh.command
executable file
·65 lines (59 loc) · 1.59 KB
/
spec-runner.sh.command
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
#!/bin/sh
###################
# gulp-node-slate #
###################
# To make this file runnable:
# $ chmod +x *.sh.command
package=https://raw.githubusercontent.com/pinntech/gulp-node-slate/master/package.json
projectHome=$(cd $(dirname $0); pwd)
webPage=api-docs/output/index.html
info() {
# Check for Node.js installation and download project dependencies
cd $projectHome
pwd
echo
echo "Node.js:"
which node || { echo "Need to install Node.js: https://nodejs.org"; exit; }
node --version
npm install
npm update
npm outdated
echo
}
showVersions() {
cd $projectHome
echo "Local changes:"
git status --short
versionLocal=v$(grep '"version"' package.json | awk -F'"' '{print $4}')
versionRemote=v$(curl --silent $package | grep '"version":' | awk -F'"' '{print $4}')
versionReleased=$(git tag | tail -1)
echo
echo "Versions:"
echo " $versionLocal (local)"
echo " $versionRemote (checked in)"
echo " $versionReleased (released)"
echo
echo "To publish release:"
echo " cd $projectHome"
echo " git tag --annotate --force --message 'Release' $versionRemote"
echo " git remote --verbose"
echo " git push origin --tags --force"
echo " npm publish"
echo
}
openBrowser() {
echo "To more quickly just run tests:"
echo " cd $projectHome"
echo " npm test"
echo " open $webPage #use Chrome or Firefox" #macOS Safari encounters: SecurityError (DOM Exception 18)
echo
sleep 2
open $webPage
}
echo
echo "Specification Runner"
echo "===================="
info
npm test
showVersions
openBrowser