diff --git a/.gitignore b/.gitignore index f82d26bf..98ecdb28 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ framework/bin framework/assets/www/.DS_Store framework/assets/www/phonegap-*.js example +test diff --git a/bin/create b/bin/create index 063497a1..1d56114e 100755 --- a/bin/create +++ b/bin/create @@ -8,7 +8,7 @@ PROJECT_PATH=${1:-"./example"} PACKAGE=${2:-"com.phonegap.example"} ACTIVITY=${3:-"PhoneGapExample"} -ACTIVITY_PATH=./Example/src/com/phonegap/example/$ACTIVITY.java +ACTIVITY_PATH=$PROJECT_PATH/src/com/phonegap/example/$ACTIVITY.java TARGET=$(android list targets | grep 'id: ' | sed 's/id: \([0-9]\).*/\1/g' | tail -1) VERSION=$(cat ./VERSION) @@ -25,13 +25,13 @@ cd ./framework && ant jar && cd ../ android create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY # copy in www -mkdir -p ./Example/assets && cp -r ./bin/templates/www ./Example/assets/www +mkdir -p $PROJECT_PATH/assets && cp -r ./bin/templates/www $PROJECT_PATH/assets/www # copy in phonegap.js -cp ./framework/assets/www/phonegap-$VERSION.js ./Example/assets/www/phonegap-$VERSION.js +cp ./framework/assets/www/phonegap-$VERSION.js $PROJECT_PATH/assets/www/phonegap-$VERSION.js # copy in phonegap.jar -mkdir -p ./Example/libs && cp ./framework/phonegap-$VERSION.jar ./Example/libs/phonegap-$VERSION.jar +mkdir -p $PROJECT_PATH/libs && cp ./framework/phonegap-$VERSION.jar $PROJECT_PATH/libs/phonegap-$VERSION.jar # copy in default activity cat ./bin/templates/Activity.java > $ACTIVITY_PATH diff --git a/bin/test b/bin/test index 2bef6b05..1c709c2a 100755 --- a/bin/test +++ b/bin/test @@ -1,3 +1,24 @@ #! /bin/sh +VERSION=$(cat ./VERSION) -echo 'TODO download mobile-spec, generate a project, copy it in, build it' +# get the latest mobile-spec +git clone git@github.com:phonegap/mobile-spec.git + +# clobber test if it exists +if [ -e ./test ] +then + rm -rf ./test +fi + +# generate a working proj +./bin/create ./test + +# kill the default app and replace it w/ mobile-spec +rm -rf ./test/assets/www +mv ./mobile-spec ./test/assets/www +cp ./framework/assets/www/phonegap-$VERSION.js ./test/assets/www/phoengap-$VERSION.js + +# build it, launch it and start logging on stdout +cd ./test && ./../bin/debug +adb shell am start -n com.phonegap.example/com.phonegap.example.PhoneGapExample +./../bin/log