Skip to content

Instantly share code, notes, and snippets.

@guilhermechapiewski
Created April 6, 2011 03:26
Show Gist options
  • Select an option

  • Save guilhermechapiewski/905076 to your computer and use it in GitHub Desktop.

Select an option

Save guilhermechapiewski/905076 to your computer and use it in GitHub Desktop.

Revisions

  1. guilhermechapiewski revised this gist Apr 6, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ PROJECT_NAME=SampleApp
    run:
    @echo "Building with Titanium..."
    @mkdir -p ${PROJECT_ROOT}/${PROJECT_NAME}/build/iphone/
    @PROJECT_NAME=${PROJECT_NAME} PROJECT_ROOT=${PROJECT_ROOT} DEVICE_TYPE=iphone bash ${PROJECT_ROOT}/titanium.sh
    @PROJECT_NAME=${PROJECT_NAME} PROJECT_ROOT=${PROJECT_ROOT} DEVICE_TYPE=iphone bash ${PROJECT_ROOT}/bin/titanium.sh
  2. guilhermechapiewski revised this gist Apr 6, 2011. 2 changed files with 0 additions and 6 deletions.
    3 changes: 0 additions & 3 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    # Makefile to start Titanium Mobile project from the command line.
    # More info at https://github.com/guilhermechapiewski/titanium-jasmine

    PROJECT_ROOT=$(shell pwd)
    PROJECT_NAME=SampleApp

    3 changes: 0 additions & 3 deletions titanium.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,5 @@
    #!/bin/bash

    # Utility script to start Titanium Mobile project from the command line.
    # More info at https://github.com/guilhermechapiewski/titanium-jasmine

    PROJECT_NAME=${PROJECT_NAME}
    PROJECT_ROOT=${PROJECT_ROOT:-../}
    APP_DEVICE=${DEVICE_TYPE}
  3. guilhermechapiewski created this gist Apr 6, 2011.
    10 changes: 10 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # Makefile to start Titanium Mobile project from the command line.
    # More info at https://github.com/guilhermechapiewski/titanium-jasmine

    PROJECT_ROOT=$(shell pwd)
    PROJECT_NAME=SampleApp

    run:
    @echo "Building with Titanium..."
    @mkdir -p ${PROJECT_ROOT}/${PROJECT_NAME}/build/iphone/
    @PROJECT_NAME=${PROJECT_NAME} PROJECT_ROOT=${PROJECT_ROOT} DEVICE_TYPE=iphone bash ${PROJECT_ROOT}/titanium.sh
    38 changes: 38 additions & 0 deletions titanium.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    #!/bin/bash

    # Utility script to start Titanium Mobile project from the command line.
    # More info at https://github.com/guilhermechapiewski/titanium-jasmine

    PROJECT_NAME=${PROJECT_NAME}
    PROJECT_ROOT=${PROJECT_ROOT:-../}
    APP_DEVICE=${DEVICE_TYPE}
    IPHONE_SDK_VERSION="4.2"
    TI_SDK_VERSION="1.6.1"
    TI_DIR="/Library/Application\ Support/Titanium"
    TI_ASSETS_DIR="${TI_DIR}/mobilesdk/osx/${TI_SDK_VERSION}"
    TI_IPHONE_DIR="${TI_ASSETS_DIR}/iphone"
    TI_BUILD="${TI_IPHONE_DIR}/builder.py"

    if [ "PROJECT_NAME" == "" ]; then
    echo "[ERROR] Please inform PROJECT_NAME."
    exit 1
    fi

    if [ "DEVICE_TYPE" == "" ]; then
    echo "[ERROR] Please inform DEVICE_TYPE ('ipad' or 'iphone')."
    exit 1
    fi

    # Get APP parameters from current tiapp.xml
    APP_ID=`cat ${PROJECT_NAME}/tiapp.xml | grep "<id>" | sed -e "s/<\/*id>//g"`
    APP_NAME=`cat ${PROJECT_NAME}/tiapp.xml | grep "<name>" | sed -e "s/<\/*name>//g"`

    if [ "APP_ID" == "" ] || [ "APP_NAME" == "" ]; then
    echo "[ERROR] Could not obtain APP parameters from tiapp.xml file (does the file exist?)."
    exit 1
    fi

    bash -c "${TI_BUILD} run ${PROJECT_ROOT}/${PROJECT_NAME}/ ${IPHONE_SDK_VERSION} ${APP_ID} ${APP_NAME} ${APP_DEVICE}" \
    | perl -pe 's/^\[DEBUG\].*$/\e[35m$&\e[0m/g;s/^\[INFO\].*$/\e[36m$&\e[0m/g;s/^\[WARN\].*$/\e[33m$&\e[0m/g;s/^\[ERROR\].*$/\e[31m$&\e[0m/g;'

    killall "iPhone Simulator"