Skip to content

Commit

Permalink
Generate the .icns for the macOS app
Browse files Browse the repository at this point in the history
Instead of adding it to the repo.
  • Loading branch information
rubiojr committed Apr 19, 2017
1 parent 76176c5 commit 41d616f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
Binary file removed assets/beehive.icns
Binary file not shown.
16 changes: 13 additions & 3 deletions script/build-app
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
# Build "native" desktop app using nativefier
# https://github.com/jiahaog/nativefier
set -e

if [ "$(uname)" != "Darwin" ]; then
echo "MacOS is the only platform currently supported" >&2
exit 1
fi
fi

if [ ! -f beehive ]; then
echo "Run 'make embed' first." >&2
Expand All @@ -18,16 +19,25 @@ if !which nativefier >/dev/null 2>&1; then
exit 1
fi

BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )"
OS_NAME=$(node -e "console.log(os.platform())")
OS_ARCH=$(node -e "console.log(os.arch())")

cleanup_osx() {
if [ -f "$icns_file" ]; then
rm -f $icns_file
fi
}

if [ "$OS_NAME" = "darwin" ]; then
trap cleanup_osx EXIT
BIN_PATH=build/app/Beehive-$OS_NAME-$OS_ARCH/Beehive.app/Contents/MacOS/
nativefier -e 1.6.6 --icon assets/beehive.icns --name Beehive http://localhost:8181 build/app
icns_file=$($BASE_PATH/build-icns)
nativefier -e 1.6.6 --icon $icns_file --name Beehive http://localhost:8181 build/app
cp beehive $BIN_PATH/beehived
chmod +x $BIN_PATH/beehived
mv $BIN_PATH/Beehive $BIN_PATH/Beehive.bin

cat > $BIN_PATH/Beehive << "EOF"
#!/bin/bash
set -e
Expand Down
30 changes: 30 additions & 0 deletions script/build-icns
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

tmpd=$TMPDIR/beehive.iconset
icns=$TMPDIR/beehive.icns
logfile=$TMPDIR/build-icns.log

cleanup() {
rm -rf $tmpd
rm -f $logfile
}

trap cleanup EXIT

{
mkdir $tmpd
sips -z 16 16 assets/logo.png --out $tmpd/icon_16x16.png
sips -z 32 32 assets/logo.png --out $tmpd/[email protected]
sips -z 32 32 assets/logo.png --out $tmpd/icon_32x32.png
sips -z 64 64 assets/logo.png --out $tmpd/[email protected]
sips -z 128 128 assets/logo.png --out $tmpd/icon_128x128.png
sips -z 256 256 assets/logo.png --out $tmpd/[email protected]
sips -z 256 256 assets/logo.png --out $tmpd/icon_256x256.png
sips -z 512 512 assets/logo.png --out $tmpd/[email protected]
sips -z 512 512 assets/logo.png --out $tmpd/icon_512x512.png
cp assets/logo.png $tmpd/[email protected]
iconutil -c icns $tmpd
} > $logfile 2>&1

echo $icns

0 comments on commit 41d616f

Please sign in to comment.