Repository navigation
Expand file tree
/
Copy pathbuild-app.sh
More file actions
executable file
·135 lines (105 loc) · 4.22 KB
/
Copy pathbuild-app.sh
File metadata and controls
executable file
·135 lines (105 loc) · 4.22 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
#!/usr/bin/env bash
set -e
# Create LightTable release using our local Electron installation
# (Mac, Linux, or Cygwin)
# Ensure we start in project root
cd "$(dirname "${BASH_SOURCE[0]}")"; cd ..
#----------------------------------------------------------------------
# Get OS-specific Electron details
#----------------------------------------------------------------------
ELECTRON_DIR="deploy/electron/node_modules/electron/dist"
# from: http://stackoverflow.com/a/17072017/142317
if [ "$(uname)" == "Darwin" ]; then
OS="mac"
PLIST="Electron.app/Contents/Info.plist"
RESOURCES="Electron.app/Contents/Resources"
PLATFORM_DIR="deploy/platform/mac"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
OS="linux"
RESOURCES="resources"
PLATFORM_DIR="deploy/platform/linux"
elif [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then
OS="windows"
RESOURCES="resources"
PLATFORM_DIR="deploy/platform/win"
else
echo "Cannot detect a supported OS."
exit 1
fi
#----------------------------------------------------------------------
# Determine release name and output location
#----------------------------------------------------------------------
META=`head -n 1 project.clj`
NAME=`echo $META | cut -d' ' -f2`
DEFAULT_VERSION=`echo $META | cut -d' ' -f3 | tr -d '"'`
: ${VERSION:="$DEFAULT_VERSION"}
BUILDS=builds
RELEASE="$NAME-$VERSION-$OS"
RELEASE_DIR="$BUILDS/$RELEASE"
RELEASE_TARBALL="${RELEASE}.tar.gz"
RELEASE_ZIP="${RELEASE}.zip"
RELEASE_RSRC="$RELEASE_DIR/$RESOURCES"
rm -rf $RELEASE_DIR $RELEASE_TARBALL $RELEASE_ZIP
rm -rf $RELEASE_DIR "$BUILDS/$RELEASE_TARBALL" "$BUILDS/$RELEASE_ZIP"
#----------------------------------------------------------------------
# Copy Electron installation and app directory into output location
#----------------------------------------------------------------------
echo "Creating $RELEASE_DIR ..."
mkdir -p $RELEASE_DIR
cp -R $ELECTRON_DIR/* $RELEASE_DIR
rm -f $RELEASE_DIR/version
cp LICENSE.md $RELEASE_DIR/LICENSE
mkdir $RELEASE_RSRC/app
cp -R deploy/core $RELEASE_RSRC/app/
cp deploy/core/package.json $RELEASE_RSRC/app/
# sed -i with arg is only cross platform way. -i '' doesn't work across platforms
sed -i.bak 's/"main.js"/"core\/main.js"/' $RELEASE_RSRC/app/package.json
rm $RELEASE_RSRC/app/package.json.bak
cp -R deploy/settings $RELEASE_RSRC/app/
cp -R deploy/plugins "${RELEASE_RSRC}"/app/
rm -rf "${RELEASE_RSRC}"/app/plugins/*/.git
#----------------------------------------------------------------------
# Polishing
#----------------------------------------------------------------------
if [ "$OS" == "mac" ]; then
cp $PLATFORM_DIR/light $RELEASE_DIR/
cp $PLATFORM_DIR/Info.plist $RELEASE_DIR/$PLIST
FULL_PLIST="$(pwd)/$RELEASE_DIR/$PLIST"
defaults write $FULL_PLIST CFBundleShortVersionString $VERSION
mv $RELEASE_DIR/Electron.app $RELEASE_DIR/LightTable.app
# Sign app to avoid endless “accept incoming connections” dialogs
codesign --force --deep --sign - $RELEASE_DIR/LightTable.app
elif [ "$OS" == "linux" ]; then
cp $PLATFORM_DIR/light $RELEASE_DIR/
mv $RELEASE_DIR/electron $RELEASE_DIR/LightTable
elif [ "$OS" == "windows" ]; then
mv $RELEASE_DIR/electron.exe $RELEASE_DIR/LightTable.exe
RCEDIT_PATH=`which rcedit` || { echo "expected to find rcedit; unable to rebrand the exe"; }
if [ "$RCEDIT_PATH" != "" ]; then
rcedit "$RELEASE_DIR/LightTable.exe" \
--set-icon deploy/core/img/lticon.ico \
--set-file-version "$VERSION" \
--set-product-version "$VERSION" \
--set-version-string "FileDescription" "Light Table" \
--set-version-string "ProductName" "Light Table" \
--set-version-string "CompanyName" "" \
--set-version-string "LegalCopyright" "" \
--set-version-string "OriginalFilename" ""
fi
fi
#----------------------------------------------------------------------
# Create release version: tarball or zip file
#----------------------------------------------------------------------
if [ "$1" == "--release" ]; then
# Create zip file for Cygwin (Windows) using 7-Zip
if [ "$OS" == "windows" ]; then
pushd "$BUILDS"
"/cygdrive/c/Program Files/7-Zip/7z.exe" a $RELEASE_ZIP "$RELEASE/*"
popd
else
pushd "$BUILDS"
tar -zcvf $RELEASE_TARBALL $RELEASE/*
popd
fi
fi
echo DONE!