-
Notifications
You must be signed in to change notification settings - Fork 2
/
make_electron.sh
executable file
·62 lines (57 loc) · 1.81 KB
/
make_electron.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
start=`date +%s`
echo --- Init
mkdir -p sugarizer
mkdir -p dist
echo --- Deleting previous content...
cd sugarizer
rm -rf *
cd ..
rm -rf build
echo --- Copying content
rsync -av --exclude-from='exclude.electron' ../sugarizer/* sugarizer
rm -rf sugarizer/activities/Jappy.activity
rm -rf sugarizer/activities/TurtleBlocksJS.activity
cp etoys_remote.index.html sugarizer/activities/Etoys.activity/index.html
sed -i -e 's/class="offlinemode"//' sugarizer/activities/Scratch.activity/index.html
if [ "$1" != "full" -a "$2" != "full" ]; then
echo --- Minimize
cd sugarizer
npm install grunt grunt-contrib-jshint grunt-contrib-nodeunit grunt-terser
grunt -v
rm -rf node_modules
cd ..
fi
if [ "$1" == "mac" -o "$2" == "mac" ]; then
cp package.json.mac sugarizer/package.json
elif [ "$1" == "win" -o "$2" == "win" ]; then
cp package.json.win sugarizer/package.json
elif [ "$1" == "snap" -o "$2" == "snap" ]; then
cp package.json.snap sugarizer/package.json
elif [ "$1" == "linux" -o "$2" == "linux" ]; then
cp package.json.linux sugarizer/package.json
else
echo ERROR: You should provide an ouput target: linux, snap or macwin
exit
fi
sed -i -e "s/\({\"id\": \"org.sugarlabs.TurtleBlocksJS\",.*\},\)//" sugarizer/activities.json
sed -i -e "s/\({\"id\": \"org.somosazucar.JappyActivity\",.*\},\)//" sugarizer/activities.json
rm sugarizer/activities.json-e
rm -rf dist/*
echo --- Create package
date
cp entitlements.mac.plist sugarizer/res
cd sugarizer
mkdir build
mkdir build/icons
cp res/icon/electron/icon-512.png build/icons/512x512.png
npm install --save
npm install electron-builder --save-dev
npm run dist
cd ..
cp -r sugarizer/dist/* dist
end=`date +%s`
runtime=$((end-start))
hours=$((runtime / 3600))
minutes=$(( (runtime % 3600) / 60 ))
seconds=$(( (runtime % 3600) % 60 ))
echo "Runtime: $hours:$minutes:$seconds (hh:mm:ss)"