You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/01/07 01:45:22 UTC
[08/10] ios commit: CB-8168 `cordova/run --list` support for iOS
(closes #122)
CB-8168 `cordova/run --list` support for iOS (closes #122)
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/54420692
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/54420692
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/54420692
Branch: refs/heads/wkwebview
Commit: 54420692ac2d4725e757b93a1771a33d56a4d87d
Parents: b53b305
Author: muratsu <su...@gmail.com>
Authored: Mon Dec 29 15:59:51 2014 -0800
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Sat Jan 3 21:08:43 2015 -0500
----------------------------------------------------------------------
bin/templates/scripts/cordova/run | 39 ++++++++++++++++++++++++++++++++++
tests/spec/create.spec.js | 13 +++++++++++-
2 files changed, 51 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/54420692/bin/templates/scripts/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/run b/bin/templates/scripts/cordova/run
index 12633bf..2cd0811 100755
--- a/bin/templates/scripts/cordova/run
+++ b/bin/templates/scripts/cordova/run
@@ -40,6 +40,11 @@ USE_SIMULATOR=false
# options
NO_BUILD=false
+# display list
+DISPLAY_LIST=false
+DISPLAY_DEVICE=false
+DISPLAY_EMULATOR=false
+
# separates "key=value", sets an array with 0th index as key, 1st index as value
_parseOption()
{
@@ -69,10 +74,15 @@ _parseArgs()
"--device")
USE_DEVICE=true
USE_SIMULATOR=false
+ DISPLAY_DEVICE=true
;;
"--emulator")
USE_DEVICE=false
USE_SIMULATOR=true
+ DISPLAY_EMULATOR=true
+ ;;
+ "--list")
+ DISPLAY_LIST=true
;;
"--nobuild")
NO_BUILD=true
@@ -81,6 +91,18 @@ _parseArgs()
done
}
+_displayDevices()
+{
+ echo "Available iOS Devices:"
+ "$CORDOVA_PATH/lib/list-devices" 2>&1 | sed 's/^/ /'
+}
+
+_displayVirtualDevices()
+{
+ echo "Available iOS Virtual Devices:"
+ "$CORDOVA_PATH/lib/list-emulator-images" 2>&1 | sed 's/^/ /'
+}
+
_parseArgs "$@"
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
@@ -93,6 +115,23 @@ DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
source "$CORDOVA_PATH/check_reqs"
+# check if it's a list command
+if "$DISPLAY_LIST"; then
+ if "$DISPLAY_DEVICE" || "$DISPLAY_EMULATOR"; then
+ if "$DISPLAY_EMULATOR"; then
+ _displayVirtualDevices
+ fi
+ if "$DISPLAY_DEVICE"; then
+ _displayDevices
+ fi
+ exit 0
+ else
+ _displayVirtualDevices
+ _displayDevices
+ exit 0
+ fi
+fi
+
# if device build found, run it first
if "$USE_DEVICE"; then
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/54420692/tests/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/create.spec.js b/tests/spec/create.spec.js
index e25440a..48d6073 100644
--- a/tests/spec/create.spec.js
+++ b/tests/spec/create.spec.js
@@ -103,4 +103,15 @@ describe('create', function() {
shell.rm('-rf', tmp);
});
-});
\ No newline at end of file
+});
+
+describe('end-to-end list validation', function(){
+ it('handles list parameter', function() {
+ shell.cp('-f', path.join(cordova_bin, 'check_reqs'), path.join(cordova_bin, 'templates', 'scripts', 'cordova', 'check_reqs'));
+ var command = '"' + path.join(cordova_bin, 'templates', 'scripts', 'cordova', 'run') + '" --list';
+ var output = shell.exec(command, {silent: true}).output;
+ expect(output).toMatch(/Available iOS Virtual Devices/);
+ expect(output).toMatch(/Available iOS Devices/);
+ shell.rm('-f', path.join(cordova_bin, 'templates', 'scripts', 'cordova', 'check_reqs'));
+ });
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org