diff --git a/test/ant.properties b/test/ant.properties
deleted file mode 100755
index ee52d86d..00000000
--- a/test/ant.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is used to override default values used by the Ant build system.
-#
-# This file must be checked in Version Control Systems, as it is
-# integral to the build system of your project.
-
-# This file is only used by the Ant script.
-
-# You can use this to override default values such as
-# 'source.dir' for the location of your java source folder and
-# 'out.dir' for the location of your output folder.
-
-# You can also use it define how the release builds are signed by declaring
-# the following properties:
-# 'key.store' for the location of your keystore and
-# 'key.alias' for the name of the key to use.
-# The password will be asked during the build when you use the 'release' target.
-
diff --git a/test/build.xml b/test/build.xml
deleted file mode 100755
index 58081116..00000000
--- a/test/build.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/cordova/android_sdk_version b/test/cordova/android_sdk_version
deleted file mode 100755
index 547f41bd..00000000
--- a/test/cordova/android_sdk_version
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var android_sdk_version = require('./lib/android_sdk_version');
-
-android_sdk_version.run().done(null, function(err) {
- console.log(err);
- process.exit(2);
-});
-
-
diff --git a/test/cordova/build b/test/cordova/build
deleted file mode 100755
index a38f3b63..00000000
--- a/test/cordova/build
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var build = require('./lib/build'),
- reqs = require('./lib/check_reqs'),
- args = process.argv;
-
-// Support basic help commands
-if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
- args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
- build.help();
-} else {
- reqs.run().then(function() {
- return build.run(args[2]);
- }).done(null, function(err) {
- console.error(err);
- process.exit(2);
- });
-}
diff --git a/test/cordova/build.bat b/test/cordova/build.bat
deleted file mode 100644
index 2f317e3b..00000000
--- a/test/cordova/build.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0build"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/check_reqs b/test/cordova/check_reqs
deleted file mode 100755
index 2ac87521..00000000
--- a/test/cordova/check_reqs
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var check_reqs = require('./lib/check_reqs');
-
-check_reqs.run().done(null, function(err) {
- console.log(err);
- process.exit(2);
-});
-
diff --git a/test/cordova/clean b/test/cordova/clean
deleted file mode 100755
index 4e0808bf..00000000
--- a/test/cordova/clean
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var clean = require('./lib/clean'),
- reqs = require('./lib/check_reqs'),
- args = process.argv;
-
-// Usage support for when args are given
-if(args.length > 2) {
- clean.help();
-} else {
- reqs.run().done(function() {
- return clean.run();
- }, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
- });
-}
diff --git a/test/cordova/clean.bat b/test/cordova/clean.bat
deleted file mode 100644
index fa1f669a..00000000
--- a/test/cordova/clean.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0clean"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/lib/android_sdk_version.js b/test/cordova/lib/android_sdk_version.js
deleted file mode 100755
index d03e1e7d..00000000
--- a/test/cordova/lib/android_sdk_version.js
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var shell = require('shelljs'),
- child_process = require('child_process'),
- Q = require('q');
-
-get_highest_sdk = function(results){
- var reg = /\d+/;
- var apiLevels = [];
- for(var i=0;i/.exec(manifestData);
- if (!activityTag) throw new Error('Could not find within ' + manifestPath);
- var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag);
- if (!activityName) throw new Error('Could not find android:name within ' + manifestPath);
-
- return packageName[1] + '/.' + activityName[1];
-}
-
-exports.getActivityName = function() {
- return cachedAppInfo = cachedAppInfo || readAppInfoFromManifest();
-};
diff --git a/test/cordova/lib/build.js b/test/cordova/lib/build.js
deleted file mode 100644
index e57e26b8..00000000
--- a/test/cordova/lib/build.js
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var shell = require('shelljs'),
- exec = require('./exec'),
- Q = require('q'),
- clean = require('./clean'),
- path = require('path'),
- fs = require('fs'),
- ROOT = path.join(__dirname, '..', '..');
-
-/*
- * Builds the project with ant.
- * Returns a promise.
- */
-module.exports.run = function(build_type) {
- //default build type
- build_type = typeof build_type !== 'undefined' ? build_type : "--debug";
- var cmd;
- switch(build_type) {
- case '--debug' :
- cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml');
- break;
- case '--release' :
- cmd = 'ant release -f ' + path.join(ROOT, 'build.xml');
- break;
- case '--nobuild' :
- console.log('Skipping build...');
- return Q();
- default :
- return Q.reject('Build option \'' + build_type + '\' not recognized.');
- }
- if(cmd) {
- return clean.run() // TODO: Can we stop cleaning every time and let ant build incrementally?
- .then(function() {
- return exec(cmd);
- });
- }
- return Q();
-}
-
-/*
- * Gets the path to the apk file, if not such file exists then
- * the script will error out. (should we error or just return undefined?)
- */
-module.exports.get_apk = function() {
- if(fs.existsSync(path.join(ROOT, 'bin'))) {
- var bin_files = fs.readdirSync(path.join(ROOT, 'bin'));
- for (file in bin_files) {
- if(path.extname(bin_files[file]) == '.apk') {
- return path.join(ROOT, 'bin', bin_files[file]);
- }
- }
- console.error('ERROR : No .apk found in \'bin\' folder');
- process.exit(2);
- } else {
- console.error('ERROR : unable to find project bin folder, could not locate .apk');
- process.exit(2);
- }
-}
-
-module.exports.help = function() {
- console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'build')) + ' [build_type]');
- console.log('Build Types : ');
- console.log(' \'--debug\': Default build, will build project in using ant debug');
- console.log(' \'--release\': will build project using ant release');
- console.log(' \'--nobuild\': will skip build process (can be used with run command)');
- process.exit(0);
-}
diff --git a/test/cordova/lib/check_reqs.js b/test/cordova/lib/check_reqs.js
deleted file mode 100644
index f4def798..00000000
--- a/test/cordova/lib/check_reqs.js
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var shell = require('shelljs'),
- child_process = require('child_process'),
- Q = require('q'),
- path = require('path'),
- fs = require('fs'),
- ROOT = path.join(__dirname, '..', '..');
-
-// Get valid target from framework/project.properties
-module.exports.get_target = function() {
- if(fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
- var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'framework', 'project.properties'));
- return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
- } else if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
- // if no target found, we're probably in a project and project.properties is in ROOT.
- var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
- return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
- }
-}
-
-// Returns a promise.
-module.exports.check_ant = function() {
- var d = Q.defer();
- child_process.exec('ant -version', function(err, stdout, stderr) {
- if (err) d.reject(new Error('ERROR : executing command \'ant\', make sure you have ant installed and added to your path.'));
- else d.resolve();
- });
- return d.promise;
-}
-
-// Returns a promise.
-module.exports.check_java = function() {
- if(process.env.JAVA_HOME) {
- var d = Q.defer();
- child_process.exec('java -version', function(err, stdout, stderr) {
- if(err) d.reject(new Error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.' + err));
- else d.resolve();
- });
- return d.promise;
- } else {
- return Q.reject(new Error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.'));
- }
-}
-
-// Returns a promise.
-module.exports.check_android = function() {
- var valid_target = this.get_target();
- var d = Q.defer();
- child_process.exec('android list targets', function(err, stdout, stderr) {
- if (err) d.reject(stderr);
- else d.resolve(stdout);
- });
-
- return d.promise.then(function(output) {
- if (!output.match(valid_target)) {
- return Q.reject(new Error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.'));
- }
- return Q();
- }, function(stderr) {
- if (stderr.match(/command\snot\sfound/)) {
- return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
- } else {
- return Q.reject(new Error('An error occurred while listing Android targets'));
- }
- });
-}
-
-// Returns a promise.
-module.exports.run = function() {
- return Q.all([this.check_ant(), this.check_java(), this.check_android()]).then(function() {
- console.log('Looks like your environment fully supports cordova-android development!');
- });
-}
-
diff --git a/test/cordova/lib/clean.js b/test/cordova/lib/clean.js
deleted file mode 100644
index 0f955f6a..00000000
--- a/test/cordova/lib/clean.js
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var exec = require('./exec'),
- path = require('path'),
- ROOT = path.join(__dirname, '..', '..');
-
-/*
- * Cleans the project using ant
- * Returns a promise.
- */
-module.exports.run = function() {
- return exec('ant clean -f ' + path.join(ROOT, 'build.xml'));
-}
-
-module.exports.help = function() {
- console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
- console.log('Cleans the project directory.');
- process.exit(0);
-}
diff --git a/test/cordova/lib/device.js b/test/cordova/lib/device.js
deleted file mode 100644
index df2a33cf..00000000
--- a/test/cordova/lib/device.js
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var exec = require('./exec'),
- Q = require('q'),
- path = require('path'),
- build = require('./build'),
- appinfo = require('./appinfo'),
- ROOT = path.join(__dirname, '..', '..');
-
-/**
- * Returns a promise for the list of the device ID's found
- */
-module.exports.list = function() {
- return exec('adb devices')
- .then(function(output) {
- var response = output.split('\n');
- var device_list = [];
- for (var i = 1; i < response.length; i++) {
- if (response[i].match(/\w+\tdevice/) && !response[i].match(/emulator/)) {
- device_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
- }
- }
- return device_list;
- });
-}
-
-/*
- * Installs a previously built application on the device
- * and launches it.
- * Returns a promise.
- */
-module.exports.install = function(target) {
- var launchName;
- return this.list()
- .then(function(device_list) {
- if (!device_list || !device_list.length)
- return Q.reject('ERROR: Failed to deploy to device, no devices found.');
-
- // default device
- target = typeof target !== 'undefined' ? target : device_list[0];
-
- if (device_list.indexOf(target) < 0)
- return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
-
- var apk_path = build.get_apk();
- launchName = appinfo.getActivityName();
- console.log('Installing app on device...');
- var cmd = 'adb -s ' + target + ' install -r ' + apk_path;
- return exec(cmd);
- }).then(function(output) {
- if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
-
- //unlock screen
- var cmd = 'adb -s ' + target + ' shell input keyevent 82';
- return exec(cmd);
- }, function(err) { return Q.reject('ERROR: Failed to install apk to device: ' + err); })
- .then(function() {
- // launch the application
- console.log('Launching application...');
- var cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
- return exec(cmd);
- }).then(function() {
- console.log('LANCH SUCCESS');
- }, function(err) {
- return Q.reject('ERROR: Failed to launch application on device: ' + err);
- });
-}
diff --git a/test/cordova/lib/emulator.js b/test/cordova/lib/emulator.js
deleted file mode 100644
index 367cd94a..00000000
--- a/test/cordova/lib/emulator.js
+++ /dev/null
@@ -1,330 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var shell = require('shelljs'),
- exec = require('./exec'),
- Q = require('q'),
- path = require('path'),
- appinfo = require('./appinfo'),
- build = require('./build'),
- ROOT = path.join(__dirname, '..', '..'),
- child_process = require('child_process'),
- new_emulator = 'cordova_emulator';
-
-/**
- * Returns a Promise for a list of emulator images in the form of objects
- * {
- name : ,
- path : ,
- target : ,
- abi : ,
- skin :
- }
- */
-module.exports.list_images = function() {
- return exec('android list avds')
- .then(function(output) {
- var response = output.split('\n');
- var emulator_list = [];
- for (var i = 1; i < response.length; i++) {
- // To return more detailed information use img_obj
- var img_obj = {};
- if (response[i].match(/Name:\s/)) {
- img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
- if (response[i + 1].match(/Path:\s/)) {
- i++;
- img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
- }
- if (response[i + 1].match(/\(API\slevel\s/)) {
- i++;
- img_obj['target'] = response[i].replace('\r', '');
- }
- if (response[i + 1].match(/ABI:\s/)) {
- i++;
- img_obj['abi'] = response[i].split('ABI: ')[1].replace('\r', '');
- }
- if (response[i + 1].match(/Skin:\s/)) {
- i++;
- img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
- }
-
- emulator_list.push(img_obj);
- }
- /* To just return a list of names use this
- if (response[i].match(/Name:\s/)) {
- emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
- }*/
-
- }
- return emulator_list;
- });
-}
-
-/**
- * Will return the closest avd to the projects target
- * or undefined if no avds exist.
- * Returns a promise.
- */
-module.exports.best_image = function() {
- var project_target = this.get_target().replace('android-', '');
- return this.list_images()
- .then(function(images) {
- var closest = 9999;
- var best = images[0];
- for (i in images) {
- var target = images[i].target;
- if(target) {
- var num = target.split('(API level ')[1].replace(')', '');
- if (num == project_target) {
- return images[i];
- } else if (project_target - num < closest && project_target > num) {
- var closest = project_target - num;
- best = images[i];
- }
- }
- }
- return best;
- });
-}
-
-// Returns a promise.
-module.exports.list_started = function() {
- return exec('adb devices')
- .then(function(output) {
- var response = output.split('\n');
- var started_emulator_list = [];
- for (var i = 1; i < response.length; i++) {
- if (response[i].match(/device/) && response[i].match(/emulator/)) {
- started_emulator_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
- }
- }
- return started_emulator_list;
- });
-}
-
-module.exports.get_target = function() {
- var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
- return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
-}
-
-// Returns a promise.
-module.exports.list_targets = function() {
- return exec('android list targets')
- .then(function(output) {
- var target_out = output.split('\n');
- var targets = [];
- for (var i = target_out.length; i >= 0; i--) {
- if(target_out[i].match(/id:/)) {
- targets.push(targets[i].split(' ')[1]);
- }
- }
- return targets;
- });
-}
-
-/*
- * Starts an emulator with the given ID,
- * and returns the started ID of that emulator.
- * If no ID is given it will used the first image availible,
- * if no image is availible it will error out (maybe create one?).
- *
- * Returns a promise.
- */
-module.exports.start = function(emulator_ID) {
- var self = this;
- var emulator_id, num_started, started_emulators;
-
- return self.list_started()
- .then(function(list) {
- started_emulators = list;
- num_started = started_emulators.length;
- if (typeof emulator_ID === 'undefined') {
- return self.list_images()
- .then(function(emulator_list) {
- if (emulator_list.length > 0) {
- return self.best_image()
- .then(function(best) {
- emulator_ID = best.name;
- console.log('WARNING : no emulator specified, defaulting to ' + emulator_ID);
- return emulator_ID;
- });
- } else {
- return Q.reject('ERROR : No emulator images (avds) found, if you would like to create an\n' +
- ' avd follow the instructions provided here:\n' +
- ' http://developer.android.com/tools/devices/index.html\n' +
- ' Or run \'android create avd --name --target \'\n' +
- ' in on the command line.');
- }
- });
- } else {
- return Q(emulator_ID);
- }
- }).then(function() {
- var cmd, args;
- if(process.platform == 'win32' || process.platform == 'win64') {
- cmd = '%comspec%';
- args = ['/c', 'start', 'cmd', '/c', 'emulator', '-avd', emulator_ID];
- } else {
- cmd = 'emulator';
- args = ['-avd', emulator_ID];
- }
- var proc = child_process.spawn(cmd, args, { stdio: 'inherit', detached: true });
- proc.unref(); // Don't wait for it to finish, since the emulator will probably keep running for a long time.
- }).then(function() {
- // wait for emulator to start
- console.log('Waiting for emulator...');
- return self.wait_for_emulator(num_started);
- }).then(function(new_started) {
- if (new_started.length > 1) {
- for (i in new_started) {
- if (started_emulators.indexOf(new_started[i]) < 0) {
- emulator_id = new_started[i];
- }
- }
- } else {
- emulator_id = new_started[0];
- }
- if (!emulator_id) return Q.reject('ERROR : Failed to start emulator, could not find new emulator');
-
- //wait for emulator to boot up
- process.stdout.write('Booting up emulator (this may take a while)...');
- return self.wait_for_boot(emulator_id);
- }).then(function() {
- console.log('BOOT COMPLETE');
-
- //unlock screen
- return exec('adb -s ' + emulator_id + ' shell input keyevent 82');
- }).then(function() {
- //return the new emulator id for the started emulators
- return emulator_id;
- });
-}
-
-/*
- * Waits for the new emulator to apear on the started-emulator list.
- * Returns a promise with a list of newly started emulators' IDs.
- */
-module.exports.wait_for_emulator = function(num_running) {
- var self = this;
- return self.list_started()
- .then(function(new_started) {
- if (new_started.length > num_running) {
- return new_started;
- } else {
- return Q.delay(1000).then(function() {
- return self.wait_for_emulator(num_running);
- });
- }
- });
-}
-
-/*
- * Waits for the boot animation property of the emulator to switch to 'stopped'
- */
-module.exports.wait_for_boot = function(emulator_id) {
- var self = this;
- return exec('adb -s ' + emulator_id + ' shell getprop init.svc.bootanim')
- .then(function(output) {
- if (output.match(/stopped/)) {
- return;
- } else {
- process.stdout.write('.');
- return Q.delay(3000).then(function() {
- return self.wait_for_boot(emulator_id);
- });
- }
- });
-}
-
-/*
- * Create avd
- * TODO : Enter the stdin input required to complete the creation of an avd.
- * Returns a promise.
- */
-module.exports.create_image = function(name, target) {
- console.log('Creating avd named ' + name);
- if (target) {
- return exec('android create avd --name ' + name + ' --target ' + target)
- .then(null, function(error) {
- console.error('ERROR : Failed to create emulator image : ');
- console.error(' Do you have the latest android targets including ' + target + '?');
- console.error(create.output);
- });
- } else {
- console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
- return exec('android create avd --name ' + name + ' --target ' + this.list_targets()[0])
- .then(function() {
- // TODO: This seems like another error case, even though it always happens.
- console.error('ERROR : Unable to create an avd emulator, no targets found.');
- console.error('Please insure you have targets availible by runing the "android" command');
- return Q.reject();
- }, function(error) {
- console.error('ERROR : Failed to create emulator image : ');
- console.error(error);
- });
- }
-}
-
-/*
- * Installs a previously built application on the emulator and launches it.
- * If no target is specified, then it picks one.
- * If no started emulators are found, error out.
- * Returns a promise.
- */
-module.exports.install = function(target) {
- var self = this;
- return this.list_started()
- .then(function(emulator_list) {
- if (emulator_list.length < 1) {
- return Q.reject('No started emulators found, please start an emultor before deploying your project.');
- }
-
- // default emulator
- target = typeof target !== 'undefined' ? target : emulator_list[0];
- if (emulator_list.indexOf(target) < 0) {
- return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
- }
-
- console.log('Installing app on emulator...');
- var apk_path = build.get_apk();
- return exec('adb -s ' + target + ' install -r ' + apk_path);
- }).then(function(output) {
- if (output.match(/Failure/)) {
- return Q.reject('Failed to install apk to emulator: ' + output);
- }
- return Q();
- }, function(err) {
- return Q.reject('Failed to install apk to emulator: ' + err);
- }).then(function() {
- //unlock screen
- return exec('adb -s ' + target + ' shell input keyevent 82');
- }).then(function() {
- // launch the application
- console.log('Launching application...');
- var launchName = appinfo.getActivityName();
- cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
- return exec(cmd);
- }).then(function(output) {
- console.log('LAUNCH SUCCESS');
- }, function(err) {
- return Q.reject('Failed to launch app on emulator: ' + err);
- });
-}
diff --git a/test/cordova/lib/exec.js b/test/cordova/lib/exec.js
deleted file mode 100644
index da1c5202..00000000
--- a/test/cordova/lib/exec.js
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var child_process = require('child_process'),
- Q = require('q');
-
-// Takes a command and optional current working directory.
-// Returns a promise that either resolves with the stdout, or
-// rejects with an error message and the stderr.
-module.exports = function(cmd, opt_cwd) {
- var d = Q.defer();
- console.log('exec: ' + cmd);
- try {
- child_process.exec(cmd, {cwd: opt_cwd, maxBuffer: 1024000}, function(err, stdout, stderr) {
- console.log([cmd, err, stdout, stderr]);
- if (err) d.reject('Error executing "' + cmd + '": ' + stderr);
- else d.resolve(stdout);
- });
- } catch(e) {
- console.error('error caught: ' + e);
- d.reject(e);
- }
- return d.promise;
-}
-
diff --git a/test/cordova/lib/install-device b/test/cordova/lib/install-device
deleted file mode 100755
index fc4b7841..00000000
--- a/test/cordova/lib/install-device
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var device = require('./device'),
- args = process.argv;
-
-if(args.length > 2) {
- var install_target;
- if (args[2].substring(0, 9) == '--target=') {
- install_target = args[2].substring(9, args[2].length);
- device.install(install_target).done(null, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
- });
- } else {
- console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
- process.exit(2);
- }
-} else {
- device.install().done(null, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
- });
-}
diff --git a/test/cordova/lib/install-device.bat b/test/cordova/lib/install-device.bat
deleted file mode 100644
index ac7214ac..00000000
--- a/test/cordova/lib/install-device.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0install-device"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/lib/install-emulator b/test/cordova/lib/install-emulator
deleted file mode 100755
index aa2a34f6..00000000
--- a/test/cordova/lib/install-emulator
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var emulator = require('./emulator'),
- args = process.argv;
-
-var install_target;
-if(args.length > 2) {
- if (args[2].substring(0, 9) == '--target=') {
- install_target = args[2].substring(9, args[2].length);
- } else {
- console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
- process.exit(2);
- }
-}
-
-emulator.install(install_target).done(null, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
-});
diff --git a/test/cordova/lib/install-emulator.bat b/test/cordova/lib/install-emulator.bat
deleted file mode 100644
index 1ec67790..00000000
--- a/test/cordova/lib/install-emulator.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0install-emulator"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/lib/list-devices b/test/cordova/lib/list-devices
deleted file mode 100755
index e390bff6..00000000
--- a/test/cordova/lib/list-devices
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var devices = require('./device');
-
-// Usage support for when args are given
-devices.list().done(function(device_list) {
- device_list && device_list.forEach(function(dev) {
- console.log(dev);
- });
-}, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
-});
-
diff --git a/test/cordova/lib/list-devices.bat b/test/cordova/lib/list-devices.bat
deleted file mode 100644
index c0bcdd9a..00000000
--- a/test/cordova/lib/list-devices.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0list-devices"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/lib/list-emulator-images b/test/cordova/lib/list-emulator-images
deleted file mode 100755
index 996cf555..00000000
--- a/test/cordova/lib/list-emulator-images
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var emulators = require('./emulator');
-
-// Usage support for when args are given
-emulators.list_images().done(function(emulator_list) {
- emulator_list && emulator_list.forEach(function(emu) {
- console.log(emu.name);
- });
-}, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
-});
diff --git a/test/cordova/lib/list-emulator-images.bat b/test/cordova/lib/list-emulator-images.bat
deleted file mode 100644
index 661cbf95..00000000
--- a/test/cordova/lib/list-emulator-images.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0list-emulator-images"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
diff --git a/test/cordova/lib/list-started-emulators b/test/cordova/lib/list-started-emulators
deleted file mode 100755
index 2ae8c5a8..00000000
--- a/test/cordova/lib/list-started-emulators
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var emulators = require('./emulator');
-
-// Usage support for when args are given
-emulators.list_started().done(function(emulator_list) {
- emulator_list && emulator_list.forEach(function(emu) {
- console.log(emu);
- });
-}, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
-});
diff --git a/test/cordova/lib/list-started-emulators.bat b/test/cordova/lib/list-started-emulators.bat
deleted file mode 100644
index a4e88f7d..00000000
--- a/test/cordova/lib/list-started-emulators.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0list-started-emulators"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/lib/log.js b/test/cordova/lib/log.js
deleted file mode 100644
index 7339b1c2..00000000
--- a/test/cordova/lib/log.js
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var shell = require('shelljs'),
- path = require('path'),
- Q = require('q'),
- child_process = require('child_process'),
- ROOT = path.join(__dirname, '..', '..');
-
-/*
- * Starts running logcat in the shell.
- * Returns a promise.
- */
-module.exports.run = function() {
- var cmd = 'adb logcat | grep -v nativeGetEnabledTags';
- var d = Q.defer();
- var adb = child_process.spawn('adb', ['logcat']);
-
- adb.stdout.on('data', function(data) {
- var lines = data ? data.toString().split('\n') : [];
- var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; });
- console.log(out.join('\n'));
- });
-
- adb.stderr.on('data', console.error);
- adb.on('close', function(code) {
- if (code > 0) {
- d.reject('Failed to run logcat command.');
- } else d.resolve();
- });
-
- return d.promise;
-}
-
-module.exports.help = function() {
- console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'log')));
- console.log('Gives the logcat output on the command line.');
- process.exit(0);
-}
diff --git a/test/cordova/lib/run.js b/test/cordova/lib/run.js
deleted file mode 100644
index 68060149..00000000
--- a/test/cordova/lib/run.js
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var path = require('path'),
- build = require('./build'),
- emulator = require('./emulator'),
- device = require('./device'),
- Q = require('q');
-
-/*
- * Runs the application on a device if availible.
- * If not device is found, it will use a started emulator.
- * If no started emulators are found it will attempt to start an avd.
- * If no avds are found it will error out.
- * Returns a promise.
- */
- module.exports.run = function(args) {
- var build_type;
- var install_target;
-
- for (var i=2; i 0 ? Q() : emulator.start();
- return p.then(function() { emulator.install(); });
- });
- } else if (install_target) {
- var devices, started_emulators, avds;
- return device.list()
- .then(function(res) {
- devices = res;
- return emulator.list_started();
- }).then(function(res) {
- started_emulators = res;
- return emulator.list_images();
- }).then(function(res) {
- avds = res;
- if (devices.indexOf(install_target) > -1) {
- return device.install(install_target);
- } else if (started_emulators.indexOf(install_target) > -1) {
- return emulator.install(install_target);
- } else {
- // if target emulator isn't started, then start it.
- var emulator_ID;
- for(avd in avds) {
- if(avds[avd].name == install_target) {
- return emulator.start(install_target)
- .then(function() { emulator.install(emulator_ID); });
- }
- }
- return Q.reject('Target \'' + install_target + '\' not found, unable to run project');
- }
- });
- } else {
- // no target given, deploy to device if availible, otherwise use the emulator.
- return device.list()
- .then(function(device_list) {
- if (device_list.length > 0) {
- console.log('WARNING : No target specified, deploying to device \'' + device_list[0] + '\'.');
- return device.install(device_list[0]);
- } else {
- return emulator.list_started()
- .then(function(emulator_list) {
- if (emulator_list.length > 0) {
- console.log('WARNING : No target specified, deploying to emulator \'' + emulator_list[0] + '\'.');
- return emulator.install(emulator_list[0]);
- } else {
- console.log('WARNING : No started emulators found, starting an emulator.');
- return emulator.best_image()
- .then(function(best_avd) {
- if(best_avd) {
- return emulator.start(best_avd.name)
- .then(function(emulator_ID) {
- console.log('WARNING : No target specified, deploying to emulator \'' + emulator_ID + '\'.');
- return emulator.install(emulator_ID);
- });
- } else {
- return emulator.start();
- }
- });
- }
- });
- }
- });
- }
- });
-}
-
-module.exports.help = function() {
- console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]');
- console.log('Build options :');
- console.log(' --debug : Builds project in debug mode');
- console.log(' --release : Builds project in release mode');
- console.log(' --nobuild : Runs the currently built project without recompiling');
- console.log('Deploy options :');
- console.log(' --device : Will deploy the built project to a device');
- console.log(' --emulator : Will deploy the built project to an emulator if one exists');
- console.log(' --target= : Installs to the target with the specified id.');
- process.exit(0);
-}
diff --git a/test/cordova/lib/start-emulator b/test/cordova/lib/start-emulator
deleted file mode 100755
index f96bdc3e..00000000
--- a/test/cordova/lib/start-emulator
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var emulator = require('./emulator'),
- args = process.argv;
-
-var install_target;
-if(args.length > 2) {
- if (args[2].substring(0, 9) == '--target=') {
- install_target = args[2].substring(9, args[2].length);
- } else {
- console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
- process.exit(2);
- }
-}
-
-emulator.start(install_target).done(null, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
-});
-
diff --git a/test/cordova/lib/start-emulator.bat b/test/cordova/lib/start-emulator.bat
deleted file mode 100644
index 9329d951..00000000
--- a/test/cordova/lib/start-emulator.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0start-emulator"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/log b/test/cordova/log
deleted file mode 100755
index 47f06050..00000000
--- a/test/cordova/log
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env node
-
-/*
- 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.
-*/
-
-var log = require('./lib/log'),
- reqs = require('./lib/check_reqs'),
- args = process.argv;
-
-// Usage support for when args are given
-if(args.length > 2) {
- log.help();
-} else {
- reqs.run().done(function() {
- return log.run();
- }, function(err) {
- console.error('ERROR: ' + err);
- process.exit(2);
- });
-}
diff --git a/test/cordova/log.bat b/test/cordova/log.bat
deleted file mode 100644
index 875982f2..00000000
--- a/test/cordova/log.bat
+++ /dev/null
@@ -1,26 +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.
-
-@ECHO OFF
-SET script_path="%~dp0log"
-IF EXIST %script_path% (
- node "%script_path%" %*
-) ELSE (
- ECHO.
- ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
- EXIT /B 1
-)
\ No newline at end of file
diff --git a/test/cordova/node_modules/.bin/shjs b/test/cordova/node_modules/.bin/shjs
deleted file mode 120000
index a0449975..00000000
--- a/test/cordova/node_modules/.bin/shjs
+++ /dev/null
@@ -1 +0,0 @@
-../shelljs/bin/shjs
\ No newline at end of file
diff --git a/test/cordova/node_modules/q/CONTRIBUTING.md b/test/cordova/node_modules/q/CONTRIBUTING.md
deleted file mode 100644
index 500ab17b..00000000
--- a/test/cordova/node_modules/q/CONTRIBUTING.md
+++ /dev/null
@@ -1,40 +0,0 @@
-
-For pull requests:
-
-- Be consistent with prevalent style and design decisions.
-- Add a Jasmine spec to `specs/q-spec.js`.
-- Use `npm test` to avoid regressions.
-- Run tests in `q-spec/run.html` in as many supported browsers as you
- can find the will to deal with.
-- Do not build minified versions; we do this each release.
-- If you would be so kind, add a note to `CHANGES.md` in an
- appropriate section:
-
- - `Next Major Version` if it introduces backward incompatibilities
- to code in the wild using documented features.
- - `Next Minor Version` if it adds a new feature.
- - `Next Patch Version` if it fixes a bug.
-
-For releases:
-
-- Run `npm test`.
-- Run tests in `q-spec/run.html` in a representative sample of every
- browser under the sun.
-- Run `npm run cover` and make sure you're happy with the results.
-- Run `npm run minify` and be sure to commit the resulting `q.min.js`.
-- Note the Gzipped size output by the previous command, and update
- `README.md` if it has changed to 1 significant digit.
-- Stash any local changes.
-- Update `CHANGES.md` to reflect all changes in the differences
- between `HEAD` and the previous tagged version. Give credit where
- credit is due.
-- Update `README.md` to address all new, non-experimental features.
-- Update the API reference on the Wiki to reflect all non-experimental
- features.
-- Use `npm version major|minor|patch` to update `package.json`,
- commit, and tag the new version.
-- Use `npm publish` to send up a new release.
-- Send an email to the q-continuum mailing list announcing the new
- release and the notes from the change log. This helps folks
- maintaining other package ecosystems.
-
diff --git a/test/cordova/node_modules/q/LICENSE b/test/cordova/node_modules/q/LICENSE
deleted file mode 100644
index 76c5fe4c..00000000
--- a/test/cordova/node_modules/q/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Copyright 2009–2012 Kristopher Michael Kowal. All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
diff --git a/test/cordova/node_modules/q/README.md b/test/cordova/node_modules/q/README.md
deleted file mode 100644
index c0f513ce..00000000
--- a/test/cordova/node_modules/q/README.md
+++ /dev/null
@@ -1,813 +0,0 @@
-[](http://travis-ci.org/kriskowal/q)
-
-
-
-
-
-If a function cannot return a value or throw an exception without
-blocking, it can return a promise instead. A promise is an object
-that represents the return value or the thrown exception that the
-function may eventually provide. A promise can also be used as a
-proxy for a [remote object][Q-Connection] to overcome latency.
-
-[Q-Connection]: https://github.com/kriskowal/q-connection
-
-On the first pass, promises can mitigate the “[Pyramid of
-Doom][POD]”: the situation where code marches to the right faster
-than it marches forward.
-
-[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
-
-```javascript
-step1(function (value1) {
- step2(value1, function(value2) {
- step3(value2, function(value3) {
- step4(value3, function(value4) {
- // Do something with value4
- });
- });
- });
-});
-```
-
-With a promise library, you can flatten the pyramid.
-
-```javascript
-Q.fcall(promisedStep1)
-.then(promisedStep2)
-.then(promisedStep3)
-.then(promisedStep4)
-.then(function (value4) {
- // Do something with value4
-})
-.catch(function (error) {
- // Handle any error from all above steps
-})
-.done();
-```
-
-With this approach, you also get implicit error propagation, just like `try`,
-`catch`, and `finally`. An error in `promisedStep1` will flow all the way to
-the `catch` function, where it’s caught and handled. (Here `promisedStepN` is
-a version of `stepN` that returns a promise.)
-
-The callback approach is called an “inversion of control”.
-A function that accepts a callback instead of a return value
-is saying, “Don’t call me, I’ll call you.”. Promises
-[un-invert][IOC] the inversion, cleanly separating the input
-arguments from control flow arguments. This simplifies the
-use and creation of API’s, particularly variadic,
-rest and spread arguments.
-
-[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
-
-
-## Getting Started
-
-The Q module can be loaded as:
-
-- A ``