You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/15 14:41:14 UTC
[cordova-windows] 03/03: new script `check_all` that does the same
thing as `cordova requirements` but can be called from the command line
This is an automated email from the ASF dual-hosted git repository.
janpio pushed a commit to branch janpio-requirements_checks
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git
commit 129b988f37de1a05d47bc733ddf4dd7862001774
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 18:54:27 2018 +0100
new script `check_all` that does the same thing as `cordova requirements` but can be called from the command line
---
bin/check_all | 34 ++++++++++++++++++++++++++++++++++
bin/check_all.bat | 25 +++++++++++++++++++++++++
bin/lib/check_reqs.js | 11 +++++++++--
3 files changed, 68 insertions(+), 2 deletions(-)
diff --git a/bin/check_all b/bin/check_all
new file mode 100644
index 0000000..84c9c97
--- /dev/null
+++ b/bin/check_all
@@ -0,0 +1,34 @@
+#!/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 for help flag
+if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
+ check_reqs.help();
+} else {
+ check_reqs.check_all().done(function success(result) {
+ console.log('check_all', result);
+ }, function (err) {
+ console.error('Error: ' + err);
+ process.exit(2);
+ });
+}
diff --git a/bin/check_all.bat b/bin/check_all.bat
new file mode 100644
index 0000000..4a7557d
--- /dev/null
+++ b/bin/check_all.bat
@@ -0,0 +1,25 @@
+:: 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="%~dp0check_all"
+IF EXIST %script_path% (
+ node "%script_path%" %*
+) ELSE (
+ ECHO.
+ ECHO ERROR: Could not find 'check_all' script in 'bin' folder, aborting...>&2
+ EXIT /B 1
+)
\ No newline at end of file
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 99d0878..bd57bef 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -388,8 +388,15 @@ function getConfig () {
config = config || new ConfigParser(path.join(__dirname, '../../config.xml'));
return Q(config);
} catch (e) {
- return Q.reject(new CordovaError('Can\'t check requirements for Windows platform.' +
- 'The config.xml file is either missing or malformed.'));
+ // try again to cover case of being called from command line
+ try {
+ config = config || new ConfigParser(path.join(__dirname, '../../template/config.xml'));
+ return Q(config);
+ } catch (e) {
+ // yeah, really no config.xml
+ return Q.reject(new CordovaError('Can\'t check requirements for Windows platform.' +
+ 'The config.xml file is either missing or malformed.'));
+ }
}
}
--
To stop receiving notification emails like this one, please contact
janpio@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org