Repository: cordova-windows Updated Branches: refs/heads/master c27396c1a -> 59f7dba09
CB-7656 Fixes list-devices and list-emulators commands Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/26c670bc Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/26c670bc Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/26c670bc Branch: refs/heads/master Commit: 26c670bc65d458da0e6a1b26a68dae02e3985a15 Parents: 70d8a7e Author: Vladimir Kotikov <[email protected]> Authored: Mon Sep 29 13:20:33 2014 +0400 Committer: Vladimir Kotikov <[email protected]> Committed: Thu Oct 2 17:43:44 2014 +0400 ---------------------------------------------------------------------- template/cordova/lib/list-devices.bat | 10 ++-- template/cordova/lib/list-emulator-images.bat | 10 +++- template/cordova/lib/list-started-emulators.bat | 2 +- template/cordova/lib/target-list.js | 49 ++++++++++++++++++++ 4 files changed, 63 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/26c670bc/template/cordova/lib/list-devices.bat ---------------------------------------------------------------------- diff --git a/template/cordova/lib/list-devices.bat b/template/cordova/lib/list-devices.bat index 016fcfc..956d1e8 100644 --- a/template/cordova/lib/list-devices.bat +++ b/template/cordova/lib/list-devices.bat @@ -15,11 +15,11 @@ :: specific language governing permissions and limitations :: under the License @ECHO OFF -SET script_path="%~dp0package.js" +SET script_path="%~dp0target-list.js" IF EXIST %script_path% ( - node -e "require('./%script_path%').listDevices().done(function(devices){console.log(devices)})" + node %script_path% %* --devices ) ELSE ( - ECHO. - ECHO ERROR: Could not find 'package' script in 'cordova/lib' folder, aborting...>&2 + ECHO. + ECHO ERROR: Could not find 'target-list.js' in cordova/lib, aborting...>&2 EXIT /B 1 -) +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/26c670bc/template/cordova/lib/list-emulator-images.bat ---------------------------------------------------------------------- diff --git a/template/cordova/lib/list-emulator-images.bat b/template/cordova/lib/list-emulator-images.bat index a06f581..4307c3e 100644 --- a/template/cordova/lib/list-emulator-images.bat +++ b/template/cordova/lib/list-emulator-images.bat @@ -15,5 +15,11 @@ :: specific language governing permissions and limitations :: under the License @ECHO OFF -ECHO Error! Windows 8 Cordova CLI tools do not support list-emulator-images currently. -EXIT /B 1 \ No newline at end of file +SET script_path="%~dp0target-list.js" +IF EXIST %script_path% ( + node %script_path% %* --emulators +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'target-list.js' in cordova/lib, aborting...>&2 + EXIT /B 1 +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/26c670bc/template/cordova/lib/list-started-emulators.bat ---------------------------------------------------------------------- diff --git a/template/cordova/lib/list-started-emulators.bat b/template/cordova/lib/list-started-emulators.bat index e576c5e..b4feccc 100644 --- a/template/cordova/lib/list-started-emulators.bat +++ b/template/cordova/lib/list-started-emulators.bat @@ -15,5 +15,5 @@ :: specific language governing permissions and limitations :: under the License @ECHO OFF -ECHO Error! Windows 8 Cordova CLI tools do not support list-started-emulators currently. +ECHO Sorry, list-started-emulators is not availible yet for Windows. 1>&2 EXIT /B 1 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/26c670bc/template/cordova/lib/target-list.js ---------------------------------------------------------------------- diff --git a/template/cordova/lib/target-list.js b/template/cordova/lib/target-list.js new file mode 100644 index 0000000..d55ad58 --- /dev/null +++ b/template/cordova/lib/target-list.js @@ -0,0 +1,49 @@ +/* + 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('./package'), + args = process.argv.slice(2); + +// help/usage function +function help() { + console.log(""); + console.log("Usage: node target-list.js [ --emulators | --devices | --started_emulators | --all ]"); + console.log(" --emulators : List the possible target emulators availible."); + console.log(" --devices : List the possible target devices availible. *NOT IMPLEMENTED YET*"); + console.log(" --started_emulators : List any started emulators availible. *NOT IMPLEMENTED YET*"); + console.log(" --all : List all available devices"); + console.log("examples:"); + console.log(" node target-list.js --emulators"); + console.log(" node target-list.js --devices"); + console.log(" node target-list.js --started_emulators"); + console.log(" node target-list.js --all"); + console.log(""); +} + +// Handle help flag +if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[0]) > -1) { + help(); +} else { + devices.listDevices() + .then(function (deviceList) { + deviceList.forEach(function (device) { + console.log(device); + }); + }); +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
