From 24944cff22ba0481cc28204578512ae811b42a6c Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Wed, 13 Jun 2012 15:42:31 -0700 Subject: [PATCH 1/2] deleting old stuff --- bin/autotest | 2 -- bin/bench | 47 ----------------------------- bin/package.json | 4 --- bin/test | 44 --------------------------- bin/tests/autotest.coffee | 24 --------------- bin/tests/create.coffee | 40 ------------------------ bin/tests/debug.coffee | 18 ----------- bin/tests/test.coffee | 0 bin/{ => tests}/test_create_unix.js | 13 ++++---- 9 files changed, 7 insertions(+), 185 deletions(-) delete mode 100755 bin/autotest delete mode 100755 bin/bench delete mode 100755 bin/test delete mode 100644 bin/tests/autotest.coffee delete mode 100644 bin/tests/create.coffee delete mode 100644 bin/tests/debug.coffee delete mode 100644 bin/tests/test.coffee rename bin/{ => tests}/test_create_unix.js (86%) diff --git a/bin/autotest b/bin/autotest deleted file mode 100755 index 647a5f55..00000000 --- a/bin/autotest +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env node -require('nodeunit').reporters.default.run(['bin/tests']) diff --git a/bin/bench b/bin/bench deleted file mode 100755 index e0de3848..00000000 --- a/bin/bench +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/sh -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -# -# Creates an app in `./bench` that posts results to http://cordova-bench.heroku.com with current cordova/Android sha. -# -# USAGE -# ./bin/bench -# - -# clobber any existing bench -if [ -e ./bench ] -then - rm -rf ./bench -fi - -# create a benching app -./bin/create ./bench org.apache.cordova.bench cordovaBench - -# grab the latest bench www code -git clone git@github.com:brianleroux/cordova-bench.git - -# copy it into the app -cat ./cordova-bench/www/index.html > ./bench/assets/www/index.html -#cat ~/Desktop/cordova-bench/www/index.html > ./bench/assets/www/index.html - -# clean up -rm -rf ./cordova-bench - -# launch to the first device found -./bin/debug ./bench diff --git a/bin/package.json b/bin/package.json index 81d3900e..27cb0eb1 100644 --- a/bin/package.json +++ b/bin/package.json @@ -18,9 +18,5 @@ "repository": { "type": "git", "url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-android.git" - }, - "dependencies":{ - "coffee-script":"1.1.2", - "nodeunit":"0.5.3" } } diff --git a/bin/test b/bin/test deleted file mode 100755 index 7e5d05e1..00000000 --- a/bin/test +++ /dev/null @@ -1,44 +0,0 @@ -#! /bin/sh -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -set -e - -VERSION=$(cat ./VERSION) - -# get the latest mobile-spec -git clone git@github.com:callback/callback-test.git - -# clobber test if it exists -if [ -e ./test ] -then - rm -rf ./test -fi - -# generate a working proj -./bin/create ./test org.apache.cordova.test CordovaTest - -# kill the default app and replace it w/ mobile-spec -rm -rf ./test/assets/www -mv ./callback-test ./test/assets/www - -# copy in cordova.js since www dir was replaced above -cp ./framework/assets/www/cordova-$VERSION.js ./test/assets/www/cordova-$VERSION.js - -# build it, launch it and start logging on stdout -cd ./test && ./cordova/debug && ./cordova/log diff --git a/bin/tests/autotest.coffee b/bin/tests/autotest.coffee deleted file mode 100644 index 1ee4c397..00000000 --- a/bin/tests/autotest.coffee +++ /dev/null @@ -1,24 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - - -exports['you are sane'] = (test) -> - test.expect 1 - test.ok true, "this assertion should always pass" - test.done() diff --git a/bin/tests/create.coffee b/bin/tests/create.coffee deleted file mode 100644 index 6c87af4f..00000000 --- a/bin/tests/create.coffee +++ /dev/null @@ -1,40 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -util = require 'util' -exec = require('child_process').exec -path = require 'path' - -exports['default example project is generated'] = (test) -> - test.expect 1 - exec './bin/create', (error, stdout, stderr) -> - test.ok true, "this assertion should pass" unless error? - test.done() - -exports['default example project has a ./.cordova folder'] = (test) -> - test.expect 1 - path.exists './example/.cordova', (exists) -> - test.ok exists, 'the cordova folder exists' - test.done() - -exports['default example project has a /cordova folder'] = (test) -> - test.expect 1 - path.exists './example/cordova', (exists) -> - test.ok exists, 'the other cordova folder exists' - test.done() diff --git a/bin/tests/debug.coffee b/bin/tests/debug.coffee deleted file mode 100644 index a5d9ebac..00000000 --- a/bin/tests/debug.coffee +++ /dev/null @@ -1,18 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ diff --git a/bin/tests/test.coffee b/bin/tests/test.coffee deleted file mode 100644 index e69de29b..00000000 diff --git a/bin/test_create_unix.js b/bin/tests/test_create_unix.js similarity index 86% rename from bin/test_create_unix.js rename to bin/tests/test_create_unix.js index 13fa29f5..3462f293 100644 --- a/bin/test_create_unix.js +++ b/bin/tests/test_create_unix.js @@ -1,4 +1,5 @@ -var project_path = '/tmp/example', +var build_path = __dirname + '/../..', + project_path = '/tmp/example', package_name = 'org.apache.cordova.example', package_as_path = 'org/apache/cordova/example', project_name = 'cordovaExample'; @@ -9,12 +10,12 @@ var path = require('path'), assert = require('assert'), spawn = require('child_process').spawn; -var version = fs.readFileSync(__dirname + '/../VERSION').toString().replace('\n', ''); +var version = fs.readFileSync(build_path + '/VERSION').toString().replace('\n', ''); assert(version !== undefined); assert(version !== ''); -var create_project = spawn(__dirname + '/create', +var create_project = spawn(build_path + '/bin/create', [project_path, package_name, project_name]); @@ -29,13 +30,13 @@ create_project.on('exit', function(code) { }); // make sure the build directory was cleaned up - path.exists(__dirname + '/framework/libs', function(exists) { + path.exists(build_path + '/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) { + path.exists(build_path + 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) { + path.exists(build_path + util.format('/framework/cordova-%s.jar', version), function(exists) { assert(!exists, 'jar file did not get cleaned up'); }); From 0a4d218010f343d15b25f6089183aded60dd310a Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Wed, 13 Jun 2012 15:52:26 -0700 Subject: [PATCH 2/2] updating test for CB-916 --- bin/create | 4 ++-- bin/create.js | 8 ++++---- bin/tests/test_create_unix.js | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/create b/bin/create index 2b3fe059..a6b5c8c6 100755 --- a/bin/create +++ b/bin/create @@ -47,8 +47,8 @@ fi # cleanup after exit and/or on error function on_exit { echo "Cleaning up ..." - [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar - [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs + # [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar + # [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs [ -f $BUILD_PATH/framework/assets/www/cordova-$VERSION.js ] && rm $BUILD_PATH/framework/assets/www/cordova-$VERSION.js [ -f $BUILD_PATH/framework/cordova-$VERSION.jar ] && rm $BUILD_PATH/framework/cordova-$VERSION.jar } diff --git a/bin/create.js b/bin/create.js index 18220553..46fd0064 100644 --- a/bin/create.js +++ b/bin/create.js @@ -52,10 +52,10 @@ function exec(s, output) { function cleanup() { // Cleanup - if(fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) { - fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6.jar'); - fso.DeleteFolder(ROOT + '\\framework\\libs', true); - } +// if(fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) { +// fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6.jar'); +// fso.DeleteFolder(ROOT + '\\framework\\libs', true); +// } if(fso.FileExists(ROOT + '\\framework\\cordova-'+VERSION+'.jar')) { fso.DeleteFile(ROOT + '\\framework\\cordova-'+VERSION+'.jar'); } diff --git a/bin/tests/test_create_unix.js b/bin/tests/test_create_unix.js index 3462f293..75e0697e 100644 --- a/bin/tests/test_create_unix.js +++ b/bin/tests/test_create_unix.js @@ -20,6 +20,15 @@ var create_project = spawn(build_path + '/bin/create', package_name, project_name]); +process.on('uncaughtException', function (err) { + console.log('Caught exception: ' + err); + spawn('rm', ['-rf', project_path], function(code) { + if(code != 0) { + console.log("Could not delete project directory"); + } + }); +}); + create_project.on('exit', function(code) { assert.equal(code, 0, 'Project did not get created'); @@ -30,9 +39,9 @@ create_project.on('exit', function(code) { }); // make sure the build directory was cleaned up - path.exists(build_path + '/framework/libs', function(exists) { - assert(!exists, 'libs directory did not get cleaned up'); - }); +// path.exists(build_path + '/framework/libs', function(exists) { +// assert(!exists, 'libs directory did not get cleaned up'); +// }); path.exists(build_path + util.format('/framework/assets/cordova-%s.js', version), function(exists) { assert(!exists, 'javascript file did not get cleaned up'); });