Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added simbundler, run 'make install' 'simbundler --source-path /path/…

…to/app'
  • Loading branch information...
commit 137eabfabfa75d1232c22c51d3ba934ecfb38534 1 parent 40edef6
@aktowns aktowns authored
Showing with 308 additions and 0 deletions.
  1. BIN  simbundler/.DS_Store
  2. +7 −0 simbundler/Makefile
  3. BIN  simbundler/resources/.DS_Store
  4. +1 −0  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/PLSimulator
  5. +1 −0  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Resources
  6. BIN  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/A/PLSimulator
  7. +38 −0 simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/A/Resources/Info.plist
  8. +1 −0  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/Current
  9. +50 −0 simbundler/resources/Launcher.app/Contents/Info.plist
  10. BIN  simbundler/resources/Launcher.app/Contents/MacOS/Launcher
  11. +1 −0  simbundler/resources/Launcher.app/Contents/PkgInfo
  12. BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/FlipsideView.nib
  13. BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/HelloWorld
  14. BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/Info.plist
  15. BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/MainView.nib
  16. BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/MainWindow.nib
  17. +1 −0  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/PkgInfo
  18. BIN  simbundler/resources/Launcher.app/Contents/Resources/English.lproj/MainMenu.nib
  19. +208 −0 simbundler/resources/bundle-tool.sh
View
BIN  simbundler/.DS_Store
Binary file not shown
View
7 simbundler/Makefile
@@ -0,0 +1,7 @@
+all:
+ echo "Run 'make install'\n"
+
+install:
+ mkdir -p /usr/local/share/simbundler
+ cp -r resources/Launcher.app /usr/local/share/simbundler/
+ cp -r resources/bundle-tool.sh /usr/local/bin/simbundler
View
BIN  simbundler/resources/.DS_Store
Binary file not shown
View
1  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/PLSimulator
View
1  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Resources
View
BIN  ...r/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/A/PLSimulator
Binary file not shown
View
38 ...es/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/A/Resources/Info.plist
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BuildMachineOSBuild</key>
+ <string>11D50</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>PLSimulator</string>
+ <key>CFBundleIdentifier</key>
+ <string>coop.plausiblelabs.PLSimulator</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>DTCompiler</key>
+ <string></string>
+ <key>DTPlatformBuild</key>
+ <string>4D502</string>
+ <key>DTPlatformVersion</key>
+ <string>GM</string>
+ <key>DTSDKBuild</key>
+ <string>10K549</string>
+ <key>DTSDKName</key>
+ <string>macosx10.6</string>
+ <key>DTXcode</key>
+ <string>0421</string>
+ <key>DTXcodeBuild</key>
+ <string>4D502</string>
+</dict>
+</plist>
View
1  simbundler/resources/Launcher.app/Contents/Frameworks/PLSimulator.framework/Versions/Current
View
50 simbundler/resources/Launcher.app/Contents/Info.plist
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BuildMachineOSBuild</key>
+ <string>11D50</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Launcher</string>
+ <key>CFBundleIconFile</key>
+ <string>Launcher.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>coop.plausible.Launcher</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Launcher</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>DTCompiler</key>
+ <string></string>
+ <key>DTPlatformBuild</key>
+ <string>4D502</string>
+ <key>DTPlatformVersion</key>
+ <string>GM</string>
+ <key>DTSDKBuild</key>
+ <string>10K549</string>
+ <key>DTSDKName</key>
+ <string>macosx10.6</string>
+ <key>DTXcode</key>
+ <string>0421</string>
+ <key>DTXcodeBuild</key>
+ <string>4D502</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.6</string>
+ <key>LSUIElement</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
View
BIN  simbundler/resources/Launcher.app/Contents/MacOS/Launcher
Binary file not shown
View
1  simbundler/resources/Launcher.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL????
View
BIN  ...ler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/FlipsideView.nib
Binary file not shown
View
BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/HelloWorld
Binary file not shown
View
BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/Info.plist
Binary file not shown
View
BIN  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/MainView.nib
Binary file not shown
View
BIN  ...ndler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/MainWindow.nib
Binary file not shown
View
1  simbundler/resources/Launcher.app/Contents/Resources/EmbeddedApp/HelloWorld.app/PkgInfo
@@ -0,0 +1 @@
+APPL????
View
BIN  simbundler/resources/Launcher.app/Contents/Resources/English.lproj/MainMenu.nib
Binary file not shown
View
208 simbundler/resources/bundle-tool.sh
@@ -0,0 +1,208 @@
+#!/bin/sh
+#
+# bundle-tool.sh
+# SimulatorLauncher
+#
+# Ported from Erica Sadun's AppleScript bundler
+# bastardized by Ashley Towns <ashleyis@mogeneration.com>
+
+PLIST_CMD="/usr/libexec/PlistBuddy"
+RSYNC="/usr/bin/rsync -aE"
+
+EMBED_DIR="Contents/Resources/EmbeddedApp"
+ICNS_FILE="Contents/Resources/Launcher.icns"
+
+# Exit constants understood by wrapping GUIs
+SUCCESS=0
+USAGE_ERROR=1
+SOURCE_APP_MISSING=2
+TEMPLATE_MISSING=3
+INVALID_DEVICE_FAMILY=4
+SOURCE_APP_INVALID=4
+DESTINATION_WRITE_FAILED=5
+
+# Print Usage
+print_usage () {
+ echo "Usage: $0 [--help] [--source-app <app>]"
+}
+
+# Check if the previous command completed successfully. If not, echo the
+# provided message and exit.
+#
+# Arguments: <msg> <exit code>
+check_error () {
+ local msg=$0
+ local code=$1
+
+ if [ $? != 0 ]; then
+ echo "${msg}"
+ exit "${code}"
+ fi
+}
+
+# Parse the application plist and set various globals
+parse_plist () {
+ PLIST="${APP}/Info.plist"
+
+ if [ ! -f "${PLIST}" ]; then
+ echo "Missing application plist"
+ exit ${SOURCE_APP_INVALID}
+ fi
+
+ # Read the display name
+ APP_NAME=`${PLIST_CMD} -c "Print CFBundleDisplayName" "${PLIST}"`
+ APP_BUNDLE_ID=`${PLIST_CMD} -c "Print CFBundleIdentifier" "${PLIST}"`
+ APP_ICON=`${PLIST_CMD} -c "Print CFBundleIconFile" "${PLIST}"`
+
+ if [ -z "${APP_NAME}" ]; then
+ echo "${APP} is missing a valid CFBundleDisplayName"
+ exit ${SOURCE_APP_INVALID}
+ fi
+
+ if [ -z "${APP_BUNDLE_ID}" ]; then
+ echo "${APP} is missing a valid CFBundleIdentifier"
+ exit ${SOURCE_APP_INVALID}
+ fi
+
+ # Convert to absolute path
+ if [ -z "${APP_ICON}" ]; then
+ # Defaults to Icon.png
+ APP_ICON="${APP}/Icon.png"
+ else
+ APP_ICON="${APP}/${APP_ICON}"
+ fi
+}
+
+# Find a unique destination path
+compute_dest_path () {
+ local dest="`dirname "${APP}"`/${APP_NAME} (iPhone Simulator)"
+ local suffix=""
+
+ # Find a unique name
+ while [ -e "${dest}${suffix}.app" ]; do
+ if [ -z ${suffix} ]; then
+ suffix=" 1"
+ else
+ suffix=" `expr ${suffix} + 1`"
+ fi
+ done
+
+ # Found it
+ APP_DEST="${dest}${suffix}.app"
+}
+
+# Populate the destination
+populate_dest_path () {
+ mkdir -p "${APP_DEST}"
+ check_error "Could not create destination directory" ${DESTINATION_WRITE_FAILED}
+
+ ${RSYNC} --exclude ${EMBED_DIR} "${TEMPLATE_APP}"/ "${APP_DEST}"/
+ check_error "Could not populate destination directory" ${DESTINATION_WRITE_FAILED}
+
+ # Copy the source app to the destination
+ mkdir -p "${APP_DEST}/${EMBED_DIR}"
+ check_error "Could not create embedded app destination directory" ${DESTINATION_WRITE_FAILED}
+ local app_dirname=`dirname "${APP}"`
+ tar -C "${app_dirname}" -cf - "`basename \"${APP}\"`" | tar -C "${APP_DEST}/${EMBED_DIR}" -xf -
+ check_error "Could not populate embedded app destination directory" ${DESTINATION_WRITE_FAILED}
+}
+
+# Convert and insert the target application's icon and bundle identifier
+populate_meta_data () {
+ local wrapper_plist="${APP_DEST}/Contents/Info.plist"
+
+ # Set the bundle identifier (original + .launchsim suffix)
+ ${PLIST_CMD} -c "Set :CFBundleIdentifier ${APP_BUNDLE_ID}.launchsim" "${wrapper_plist}"
+ check_error "Failed to modify wrapper application's plist" ${DESTINATION_WRITE_FAILED}
+
+ # Convert the embedded application's icon
+ if [ -f "${APP_ICON}" ]; then
+ local resampled=`mktemp /tmp/${tempfoo}.XXXXXX`
+ check_error "Could not create temporary file for Icon resampling" ${DESTINATION_WRITE_FAILED}
+
+ # Convert the icon. If we were really cool, we'd support applying the same effects that Apple
+ # does. Use ImageMagick if available.
+ local convert=`which convert`
+ if [ ! -z "$convert" ]; then
+ $convert "${APP_ICON}" -resample 128x128 "${APP_DEST}/${ICNS_FILE}"
+ else
+ /usr/bin/sips --resampleWidth 128 -s format icns "${APP_ICON}" --out "${APP_DEST}/${ICNS_FILE}"
+ fi
+ check_error "Failed to convert application icon" ${DESTINATION_WRITE_FAILED}
+
+ # Clean up
+ rm -f "${resampled}"
+ fi
+
+ # Set the default device family
+ if [ ! -z "${DEVICE_FAMILY}" ]; then
+ if [ "${DEVICE_FAMILY}" = "iPhone" ]; then
+ local family="1"
+ elif [ "${DEVICE_FAMILY}" = "iPad" ]; then
+ local family="2"
+ else
+ # A literal device family value
+ local family="${DEVICE_FAMILY}"
+ fi
+
+ ${PLIST_CMD} -c "Add PLDefaultUIDeviceFamily string ${DEVICE_FAMILY}" "${wrapper_plist}"
+ check_error "Failed to set device family in application's plist" ${DESTINATION_WRITE_FAILED}
+ fi
+}
+
+# Parse command line arguments
+while [ $# -gt 0 ]; do
+ case $1 in
+ --source-app)
+ shift
+ if [ ! -d "$1" ]; then
+ echo "No app found at ${1}."
+ exit 1
+ fi
+ APP="$1"
+ shift
+ ;;
+ --help)
+ print_usage
+ exit 0
+ ;;
+ *)
+ echo "Unknown option $1" 1>&2
+ print_usage
+ exit ${USAGE_ERROR}
+ esac
+done
+
+TEMPLATE_APP="/usr/local/share/simbundler/Launcher.app"
+DEVICE_FAMILY="iPad"
+
+if [ -z "${APP}" ]; then
+ echo "--source-app must be supplied"
+ print_usage
+ exit ${USAGE_ERROR}
+fi
+
+# Check file paths
+if [ ! -d "${APP}" ]; then
+ echo "No app found at ${APP}."
+ exit ${SOURCE_APP_MISSING}
+fi
+
+if [ ! -d "${TEMPLATE_APP}" ]; then
+ echo "No template app found at ${APP}."
+ exit ${SOURCE_APP_MISSING}
+fi
+
+# Parse the plist
+parse_plist
+echo "App Name: ${APP_NAME}"
+
+# Compute the destination path
+compute_dest_path
+echo "Destination: ${APP_DEST}"
+
+# Populate the destination with the template data
+populate_dest_path
+
+# Add meta-data
+populate_meta_data
Please sign in to comment.
Something went wrong with that request. Please try again.