forked from node-hid/node-hid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·48 lines (39 loc) · 912 Bytes
/
install.sh
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
#!/bin/sh
set -e
nodewebkit_version() {
grep -o '"nodewebkit":.*"\(.*\)"' package.json |\
sed 's/.*webkit":.*"\(.*\)".*/\1/'
}
nw_gyp() {
dir=$1
version=$(echo $2 | sed 's/[^0-9rcRC.\-]//g')
cd $dir
echo "Configuring nw-gyp for target=$version"
nw-gyp configure --target=$version
nw-gyp build
}
[ -d build ] && node-gyp clean
if which nw-gyp >/dev/null
then
# we've got nw-gyp... check if we're in a node-webkit project
myDir=$PWD
cd ..
parentDir=${PWD##*/}
while [ $parentDir == 'node_modules' ]
do
cd ..
currentProject=${PWD##*/}
version=$(nodewebkit_version)
if [ a$version != a ]
then
nw_gyp $myDir $version
exit
fi
cd ..
parentDir=${PWD##*/}
done
# go back home
cd $myDir
fi
# no? just do boring node-gyp
node-gyp configure build install