#! /bin/sh # # create a phonegap/android project # # USAGE # ./create [path package activity] # set -e PROJECT_PATH=${1:-"./example"} PACKAGE=${2:-"com.phonegap.example"} ACTIVITY=${3:-"PhoneGapExample"} TARGET=$(android list targets | grep 'id: ' | sed 's/id: \([0-9]*\).*/\1/g' | tail -1) VERSION=$(cat ./VERSION) # clobber any existing example if [ $# -eq 0 ] then rm -rf $PROJECT_PATH fi # update the phonegap-android framework for the desired target android update project --target $TARGET --path ./framework # compile phonegap.js and phonegap.jar cd ./framework && ant jar && cd ../ # copy all the bin scripts etc in there cp -R ./bin/templates/project/ $PROJECT_PATH # copy in phonegap.js cp ./framework/assets/www/phonegap-$VERSION.js $PROJECT_PATH/.phonegap/android/phonegap-$VERSION.js # copy in phonegap.jar cp ./framework/phonegap-$VERSION.jar $PROJECT_PATH/.phonegap/android/phonegap-$VERSION.jar # app properties cat > $PROJECT_PATH/.phonegap/config <