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/14 14:45:54 UTC
[cordova-windows] branch master updated: CB-13875 add `prepare`
script that can be called in e2e tests (#254)
This is an automated email from the ASF dual-hosted git repository.
janpio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git
The following commit(s) were added to refs/heads/master by this push:
new 20ed375 CB-13875 add `prepare` script that can be called in e2e tests (#254)
20ed375 is described below
commit 20ed375676ff4dc7b772b40a7f18455a650a2028
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 15:45:52 2018 +0100
CB-13875 add `prepare` script that can be called in e2e tests (#254)
* CB-13875 add `prepare` script that can be called in e2e tests to prepare project files
(based on `clean` and some terrible code to build a `project` object)
also adds default `config.xml`
* minimal config.xml
* less minimal
* fix www source folder
---
spec/e2e/endtoend.spec.js | 3 +++
template/config.xml | 10 ++++++--
template/cordova/prepare | 61 ++++++++++++++++++++++++++++++++++++++++++++
template/cordova/prepare.bat | 25 ++++++++++++++++++
4 files changed, 97 insertions(+), 2 deletions(-)
diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index 34b9a44..97dbf41 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -34,6 +34,8 @@ describe('Cordova create and build', function () {
var buildDirectory = path.join(__dirname, '../..');
var appPackagesFolder = path.join(buildDirectory, projectFolder, 'AppPackages');
var buildScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'build') + '"';
+ var prepareScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'prepare') + '"';
+
var silent = false;
function verifySubDirContainsFile (subDirName, fileName, count) {
@@ -60,6 +62,7 @@ describe('Cordova create and build', function () {
beforeEach(function () {
shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', {silent: silent});
+ shell.exec(prepareScriptPath + '', {silent: silent});
});
afterEach(function () {
diff --git a/template/config.xml b/template/config.xml
index 1850536..c8b4a2c 100644
--- a/template/config.xml
+++ b/template/config.xml
@@ -19,6 +19,12 @@
# under the License.
#
-->
-<widget xmlns="http://www.w3.org/ns/widgets">
-
+<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>HelloCordova</name>
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+ <author email="dev@cordova.apache.org" href="http://cordova.io">
+ Apache Cordova Team
+ </author>
</widget>
diff --git a/template/cordova/prepare b/template/cordova/prepare
new file mode 100644
index 0000000..e919b77
--- /dev/null
+++ b/template/cordova/prepare
@@ -0,0 +1,61 @@
+#!/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 Api = require('./Api');
+var nopt = require('nopt');
+var path = require('path');
+var ConfigParser = require('cordova-common').ConfigParser;
+
+// Support basic help commands
+if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
+ console.log('Usage: \n prepare\n');
+ process.exit(0);
+}
+
+// Do some basic argument parsing
+var opts = nopt({
+ 'verbose' : Boolean,
+ 'silent' : Boolean
+}, { 'd' : '--verbose' });
+
+// Make buildOptions compatible with PlatformApi clean method spec
+opts.argv = opts.argv.original;
+
+// Skip cleaning prepared files when not invoking via cordova CLI.
+opts.noPrepare = true;
+
+require('./lib/loggingHelper').adjustLoggerLevel(opts);
+
+var projectRoot = path.join(__dirname, '..');
+var project = {
+ root: projectRoot,
+ projectConfig: new ConfigParser(path.join(projectRoot, 'config.xml')),
+ locations: {
+ plugins: path.join(projectRoot, 'plugins'),
+ www: path.join(projectRoot, 'www')
+ }
+};
+
+new Api().prepare(project, opts)
+.catch(function(err) {
+ console.error(err.stack);
+ process.exit(2);
+});
diff --git a/template/cordova/prepare.bat b/template/cordova/prepare.bat
new file mode 100644
index 0000000..eb14e74
--- /dev/null
+++ b/template/cordova/prepare.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="%~dp0prepare"
+IF EXIST %script_path% (
+ node %script_path% %*
+) ELSE (
+ ECHO.
+ ECHO ERROR: Could not find 'preapre' script in 'cordova' folder, aborting...>&2
+ EXIT /B 1
+)
\ No newline at end of file
--
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