#! /bin/sh # # create a phonegap/android project # # USAGE # ./create [path package activity] # # load up the config . ./.phonegap/config PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g') ACTIVITY_PATH=./src/$PACKAGE_AS_PATH/$ACTIVITY.java MANIFEST_PATH=./AndroidManifest.xml # create the project android create project --target $TARGET --path . --package $PACKAGE --activity $ACTIVITY # copy all the phonegap scripts etc in there cp -R ./phonegap/templates/project/ . # copy in phonegap.js cp ./.phonegap/android/phonegap-$VERSION.js ./assets/www # copy in phonegap.jar cp ./.phonegap/android/phonegap-$VERSION.jar ./libs # copy in default activity cat ./phonegap/templates/Activity.java > $ACTIVITY_PATH # interpolate the acivity name and package find "$ACTIVITY_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i "" "s/__ACTIVITY__/${ACTIVITY}/g" find "$ACTIVITY_PATH" | xargs grep '__ID__' -sl | xargs -L1 sed -i "" "s/__ID__/${PACKAGE}/g" find "$MANIFEST_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i "" "s/__ACTIVITY__/${ACTIVITY}/g" find "$MANIFEST_PATH" | xargs grep '__PACKAGE__' -sl | xargs -L1 sed -i "" "s/__PACKAGE__/${PACKAGE}/g"