first pass at a test script

This commit is contained in:
brianleroux 2011-08-18 19:20:41 -07:00
parent efe021916e
commit 2f9060dd3e
3 changed files with 27 additions and 5 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ framework/bin
framework/assets/www/.DS_Store framework/assets/www/.DS_Store
framework/assets/www/phonegap-*.js framework/assets/www/phonegap-*.js
example example
test

View File

@ -8,7 +8,7 @@
PROJECT_PATH=${1:-"./example"} PROJECT_PATH=${1:-"./example"}
PACKAGE=${2:-"com.phonegap.example"} PACKAGE=${2:-"com.phonegap.example"}
ACTIVITY=${3:-"PhoneGapExample"} 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) TARGET=$(android list targets | grep 'id: ' | sed 's/id: \([0-9]\).*/\1/g' | tail -1)
VERSION=$(cat ./VERSION) VERSION=$(cat ./VERSION)
@ -25,13 +25,13 @@ cd ./framework && ant jar && cd ../
android create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY android create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY
# copy in www # 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 # 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 # 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 # copy in default activity
cat ./bin/templates/Activity.java > $ACTIVITY_PATH cat ./bin/templates/Activity.java > $ACTIVITY_PATH

View File

@ -1,3 +1,24 @@
#! /bin/sh #! /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