Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 42 lines (31 sloc) 1.287 kb
#! /bin/sh
#
# create a cordova/android project
#
# USAGE
# ./create [path package activity]
#
# load up the config
. ./.cordova/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 cordova scripts etc in there
cp -R ./cordova/templates/project/* .
# copy in cordova.js
cp ./.cordova/android/cordova-$VERSION.js ./assets/www
# copy in cordova.jar
cp ./.cordova/android/cordova-$VERSION.jar ./libs
# copy in res/xml
mkdir ./res/xml
cp ./.cordova/android/cordova.xml ./res/xml
cp ./.cordova/android/plugins.xml ./res/xml
# copy in default activity
cat ./cordova/templates/Activity.java > $ACTIVITY_PATH
# interpolate the acivity name and package
find "$ACTIVITY_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i -e "s/__ACTIVITY__/${ACTIVITY}/g"
find "$ACTIVITY_PATH" | xargs grep '__ID__' -sl | xargs -L1 sed -i -e "s/__ID__/${PACKAGE}/g"
find "$MANIFEST_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i -e "s/__ACTIVITY__/${ACTIVITY}/g"
find "$MANIFEST_PATH" | xargs grep '__PACKAGE__' -sl | xargs -L1 sed -i -e "s/__PACKAGE__/${PACKAGE}/g"
Jump to Line
Something went wrong with that request. Please try again.