Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBB9B96F1 for ; Tue, 12 Jun 2012 23:11:24 +0000 (UTC) Received: (qmail 12346 invoked by uid 500); 12 Jun 2012 23:11:24 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 12319 invoked by uid 500); 12 Jun 2012 23:11:24 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 12238 invoked by uid 99); 12 Jun 2012 23:11:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2012 23:11:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 198D45DB2; Tue, 12 Jun 2012 23:11:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [14/18] android commit: testing create2 script Message-Id: <20120612231124.198D45DB2@tyr.zones.apache.org> Date: Tue, 12 Jun 2012 23:11:23 +0000 (UTC) testing create2 script Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/825b9eaf Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/825b9eaf Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/825b9eaf Branch: refs/heads/master Commit: 825b9eafc2537e6d49316bd83ebb9faf53b023fa Parents: 8451133 Author: Anis Kadri Authored: Mon Jun 4 17:59:42 2012 -0700 Committer: Anis Kadri Committed: Mon Jun 4 17:59:42 2012 -0700 ---------------------------------------------------------------------- bin/test_create2.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/825b9eaf/bin/test_create2.js ---------------------------------------------------------------------- diff --git a/bin/test_create2.js b/bin/test_create2.js new file mode 100644 index 0000000..1df5dd5 --- /dev/null +++ b/bin/test_create2.js @@ -0,0 +1,90 @@ +var project_path = '/tmp/example', + package_name = 'org.apache.cordova.example', + package_as_path = 'org/apache/cordova/example', + project_name = 'cordovaExample'; + +var path = require('path'), + fs = require('fs'), + util = require('util'), + assert = require('assert'), + spawn = require('child_process').spawn; + +var version = fs.readFileSync(__dirname + '/../VERSION').toString().replace('\n', ''); + +assert(version !== undefined); +assert(version !== ''); + +var create_project = spawn(__dirname + '/create2', + [project_path, + package_name, + project_name]); + +create_project.on('exit', function(code) { + + assert.equal(code, 0, 'Project did not get created'); + + // make sure the project was created + path.exists(project_path, function(exists) { + assert(exists, 'Project path does not exist'); + }); + + // make sure the build directory was cleaned up + path.exists(__dirname + '/framework/libs', function(exists) { + assert(!exists, 'libs directory did not get cleaned up'); + }); + path.exists(__dirname + util.format('/framework/assets/cordova-%s.js', version), function(exists) { + assert(!exists, 'javascript file did not get cleaned up'); + }); + path.exists(__dirname + util.format('/framework/cordova-%s.jar', version), function(exists) { + assert(!exists, 'jar file did not get cleaned up'); + }); + + // make sure AndroidManifest.xml was added + path.exists(util.format('%s/AndroidManifest.xml', project_path), function(exists) { + assert(exists, 'AndroidManifest.xml did not get created'); + // TODO check that the activity name was properly substituted + }); + + // make sure main Activity was added + path.exists(util.format('%s/src/%s/%s.java', project_path, package_as_path, project_name), function(exists) { + assert(exists, 'Activity did not get created'); + // TODO check that package name and activity name were substitued properly + }); + + // make sure plugins.xml was added + path.exists(util.format('%s/res/xml/plugins.xml', project_path), function(exists) { + assert(exists, 'plugins.xml did not get created'); + }); + + // make sure cordova.xml was added + path.exists(util.format('%s/res/xml/cordova.xml', project_path), function(exists) { + assert(exists, 'plugins.xml did not get created'); + }); + + // make sure cordova.jar was added + path.exists(util.format('%s/libs/cordova-%s.jar', project_path, version), function(exists) { + assert(exists, 'cordova.jar did not get added'); + }); + + // make sure cordova.js was added + path.exists(util.format('%s/assets/www/cordova-%s.js', project_path, version), function(exists) { + assert(exists, 'cordova.js did not get added'); + }); + + // check that project compiles && creates a cordovaExample-debug.apk + var compile_project = spawn('ant', ['debug'], {cwd: project_path}); + + compile_project.on('exit', function(code) { + assert.equal(code, 0, 'Cordova Android Project does not compile'); + // make sure cordovaExample-debug.apk was created + path.exists(util.format('%s/bin/%s-debug.apk', project_path, project_name), function(exists) { + assert(exists, 'Package did not get created'); + + // if project compiles properly just AXE it + spawn('rm', ['-rf', project_path], function(code) { + assert.equal(code, 0, 'Could not remove project directory'); + }); + }); + }); + +});