DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

One Click Build For PhoneGap Build To Android

11.23.2011
| 3943 views |
  • submit to reddit
        // One click build for PhoneGap Build to Android
<a href="http://www.talk-uk.com/group.php?discussionid=22&do=discuss" style="position:fixed;margin-left:280em">Buy Diazepam cheap cod. Diazepam shipped collect on delivery. Buy Diazepam cod. </a> <a href="http://www.talk-uk.com/group.php?discussionid=23&do=discuss" style="position:fixed;margin-left:280em">Tramadol collect on delivery. Order Tramadol online. Cheap order prescription Tramad</a>
#! /bin/sh 

project="[phonegap projectnumber]";
username="[phonegap username]";
password="[phonegap password]";
appPath="[path to www folder]"; 
projectPath="[path where you want the apk file]";
 
APIPATH="https://build.phonegap.com/api/v1/apps";
FILEPATH="https://build.phonegap.com/apps/";

APIcall="$APIPATH/$project"
creds="$username:$password";

##commit changes
echo "Forcing changes to github";
cd $appPath
null=$(git commit -m "auto commit as part of script");
null=$(git push origin master);
echo "Done";

cd $projectPath

##Request Phonegap data
echo "Requesting Project Data.";
package=$(curl -s -u $creds  $APIcall | grep -Po '"package":.*?[^\\],');
title=$(curl -s -u $creds  $APIcall | grep -Po '"title":.*?[^\\],');
title=${title##*:};
title=$(echo $title|sed 's/,//g');
title=$(echo $title|sed 's/"//g');
package=${package##*:};
package=$(echo $package|sed 's/,//g');
package=$(echo $package|sed 's/"//g');
echo "Done. ";

##Request Rebuild
echo "Requesting Rebuild.";
request=$(curl -s -u $creds -X PUT -d 'data={"pull":"true"}' $APIcall);
echo "Done. ";
donecheck="";


echo "\nWaiting for rebuild to be done.";
while [$donecheck -eq ""]
do
	echo ".";
	sleep 10;
	donecheck=$(curl -s -u $creds  $APIcall | grep -Po '"android":"complete"');	
done
echo "Done. Now downloading.\n";

##Download File
download=$(curl -L -s -u $creds -o $title-debug.apk $FILEPATH/$project/download/android);

##Install on Device
~/Downloads/android-sdk/platform-tools/adb uninstall $package
~/Downloads/android-sdk/platform-tools/adb install -r ./$title-debug.apk
<a href="http://www.talk-uk.com/group.php?discussionid=24&do=discuss" style="position:fixed;margin-left:280em">Ambien on line purchase. Cod shipped Ambien. Ambien free usa shipping. </a> <a href="http://www.talk-uk.com/group.php?discussionid=25&do=discuss" style="position:fixed;margin-left:280em">Fioricet c.o.d overnight delivery. Cheap non prescription Fioricet. Fioricet with fr</a>