Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
add mac installer
Browse files Browse the repository at this point in the history
  • Loading branch information
dualface committed Sep 30, 2016
1 parent 3d42f98 commit ac5de39
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ lua-project/simulator/

contents.xcworkspacedata
xcuserdata

installer/mac/Install\ Legacy\ Support.app/Contents/Resources/dists/
installer/mac/*.dmg

Binary file added installer/assets/Icon.icns
Binary file not shown.
Binary file added installer/assets/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions installer/mac/Install Legacy Support.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>install.sh</string>
<key>CFBundleIconFile</key>
<string>Icon</string>
</dict>
</plist>

19 changes: 19 additions & 0 deletions installer/mac/Install Legacy Support.app/Contents/MacOS/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
CURRENT_DIR=$(dirname "$0")
DEST_DIR="$HOME/.CocosCreator/packages/"

mkdir -p -v $DEST_DIR
cd $DEST_DIR

cd "$CURRENT_DIR/../Resources/dists/"
cp -Rf . "$DEST_DIR"

cd "$CURRENT_DIR/../Resources"
ICON_PATH="$(pwd)/Icon.icns"

MESSGE="Install Completed. Enjoy It!\n\nHow to use:\n 1. Launch Creator, open your Creator project\n 2. Choose menu 'Project -> Legacy Support -> Setup Target Project\n 3. Copy support library and Build\n\nMore information please check\nhttps://github.com/cocos-creator/creator-lua"
TITLE="Install Creator Legacy Support"

CMD="tell app \"System Events\" to display dialog \"$MESSGE\" buttons \"OK\" with icon POSIX file \"$ICON_PATH\" with title \"$TITLE\""
osascript -e "$CMD"

Binary file not shown.
19 changes: 19 additions & 0 deletions installer/mac/install-dmg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"title": "Install Creator Legacy Support VERSION",
"icon": "../assets/Icon.icns",
"icon-size": 256,
"window": {
"size": {
"width": 480,
"height": 400
}
},
"contents": [
{
"x": 240,
"y": 160,
"type": "file",
"path": "Install Legacy Support.app"
}
]
}
31 changes: 31 additions & 0 deletions installer/mac/make-install-dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
CURRENT_DIR=$(cd "$(dirname $0)" && pwd)

PACKAGE_NAME="creator-legacy-support"
APP_NAME="Install Legacy Support"
APP_DIR="$CURRENT_DIR/$APP_NAME.app"
DISTS_DIR="$APP_DIR/Contents/Resources/dists/$PACKAGE_NAME"
PACKAGE_SRCDIR="$CURRENT_DIR/../../creator-project/packages/$PACKAGE_NAME/"
PACKAGE_VERSION=$( sed -n 's/.*"version": "\(.*\)",/\1/p' "$PACKAGE_SRCDIR/package.json" )
DMG_FILENAME="Install-Creator-Legacy-Support-$PACKAGE_VERSION.dmg"
CONFIG_FILENAME="install-dmg.json"
TEMP_CONFIG_FILENAME="install-dmg-work.json"

sed "s/VERSION/$PACKAGE_VERSION/g" "$CONFIG_FILENAME" > "$TEMP_CONFIG_FILENAME"

mkdir -p "$DISTS_DIR"

cd "$DISTS_DIR"
cp -R "$PACKAGE_SRCDIR" .

cd "$CURRENT_DIR"

if [ -f "$DMG_FILENAME" ]; then
rm "$DMG_FILENAME"
fi

appdmg "$TEMP_CONFIG_FILENAME" "$DMG_FILENAME"
rm "$TEMP_CONFIG_FILENAME"

open .

0 comments on commit ac5de39

Please sign in to comment.