You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2015/03/06 20:04:34 UTC
cordova-medic git commit: CB-8623 Removed obsolete jasmineReporter
patching code
Repository: cordova-medic
Updated Branches:
refs/heads/master 3016068dc -> eb060496c
CB-8623 Removed obsolete jasmineReporter patching code
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/eb060496
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/eb060496
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/eb060496
Branch: refs/heads/master
Commit: eb060496c7d4aba488d0d6cd55ca4c235066f356
Parents: 3016068
Author: alsorokin <al...@akvelon.com>
Authored: Fri Mar 6 19:03:36 2015 +0300
Committer: alsorokin <al...@akvelon.com>
Committed: Fri Mar 6 19:03:36 2015 +0300
----------------------------------------------------------------------
build_windows.js | 2 +-
build_wp8.js | 2 +-
src/build/makers/blackberry10.js | 34 +++++++---------
src/build/makers/mobile_spec.js | 40 -------------------
src/build/makers/windows.js | 59 ++++++++++------------------
src/build/makers/wp8.js | 74 ++++++++++++-----------------------
6 files changed, 60 insertions(+), 151 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/build_windows.js
----------------------------------------------------------------------
diff --git a/build_windows.js b/build_windows.js
index 4cb5f01..bab3d69 100644
--- a/build_windows.js
+++ b/build_windows.js
@@ -60,7 +60,7 @@ buildinfo('Windows', BRANCH, function (error, sha) {
// add medic configuration (sha, host) to destination folder
createMedicJson(path.join(MSPEC_DIR, 'www'), sha, config);
- windows(output_location, sha, config.app.entry, test_timeout, build_target)
+ windows(output_location, sha, test_timeout, build_target)
.then(function onSuccess() {
return testcheck(sha, config.couchdb.host);
}, function onError(err) {
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/build_wp8.js
----------------------------------------------------------------------
diff --git a/build_wp8.js b/build_wp8.js
index 356ff4c..73934db 100644
--- a/build_wp8.js
+++ b/build_wp8.js
@@ -31,7 +31,7 @@ buildinfo('WP8', BRANCH, function (error, sha) {
// timeout to execute tests, 10 min by default
var test_timeout = config.app.timeout || 10 * 60;
- wp8(output_location, sha, config.wp8.target, config.app.entry, test_timeout)
+ wp8(output_location, sha, config.wp8.target, test_timeout)
.then(function onSuccess() {
return testcheck(sha, config.couchdb.host);
}, function onError(err) {
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/src/build/makers/blackberry10.js
----------------------------------------------------------------------
diff --git a/src/build/makers/blackberry10.js b/src/build/makers/blackberry10.js
index f3e8ea8..dac4591 100644
--- a/src/build/makers/blackberry10.js
+++ b/src/build/makers/blackberry10.js
@@ -4,8 +4,7 @@ var shell = require('shelljs'),
n = require('ncallbacks'),
deploy = require('./blackberry10/deploy'),
scan = require('./blackberry10/devices'),
- fs = require('fs'),
- mspec = require('./mobile_spec');
+ fs = require('fs');
module.exports = function(output, sha, entry_point, couchdb_host, callback) {
function log(msg) {
@@ -18,25 +17,20 @@ module.exports = function(output, sha, entry_point, couchdb_host, callback) {
}
var mspec_out = path.join(output, 'www');
log('Modifying Cordova Mobilespec application at:' + mspec_out);
- mspec(mspec_out, sha, '', entry_point, function(err){
- if(err) {
- error_writer('blackberry', sha, 'Error modifying mobile spec application.', '');
- callback(true);
- } else {
- log('Modifying Cordova blackberry application.');
- // add the sha to the junit reporter
- var tempJasmine = path.join(output, 'www', 'jasmine-jsreporter.js');
- if (fs.existsSync(tempJasmine)) {
- fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
- }
+
+ log('Modifying Cordova blackberry application.');
+ // add the sha to the junit reporter
+ var tempJasmine = path.join(output, 'www', 'jasmine-jsreporter.js');
+ if (fs.existsSync(tempJasmine)) {
+ fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
+ }
+
+ // modify start page in the config.xml
+ var configFile = path.join(output, 'config.xml');
+ fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<content\s*src=".*"/gi, '<content src="' +entry_point + '"'), 'utf-8');
+ // make sure the couch db server is whitelisted
+ fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<access origin="http:..audio.ibeat.org" *.>/gi,'<access subdomains="true" origin="http://apache.org" /><access subdomains="true" origin="https://apache.org"/><access subdomains="true" origin="http://audio.ibeat.org" /><access subdomains="true" origin="'+couchdb_host+'" />', 'utf-8'));
- // modify start page in the config.xml
- var configFile = path.join(output, 'config.xml');
- fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<content\s*src=".*"/gi, '<content src="' +entry_point + '"'), 'utf-8');
- // make sure the couch db server is whitelisted
- fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(/<access origin="http:..audio.ibeat.org" *.>/gi,'<access subdomains="true" origin="http://apache.org" /><access subdomains="true" origin="https://apache.org"/><access subdomains="true" origin="http://audio.ibeat.org" /><access subdomains="true" origin="'+couchdb_host+'" />', 'utf-8'));
- }
- });
} catch (e) {
error_writer('blackberry', sha, 'Exception thrown modifying BlackBerry mobile spec application.', e.message);
callback(true);
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/src/build/makers/mobile_spec.js
----------------------------------------------------------------------
diff --git a/src/build/makers/mobile_spec.js b/src/build/makers/mobile_spec.js
deleted file mode 100644
index 3013d2a..0000000
--- a/src/build/makers/mobile_spec.js
+++ /dev/null
@@ -1,40 +0,0 @@
-
-/*
-Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
-
-Licensed 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'),
- config = require('../../../config'),
- fs = require('fs');
-
-var jasmineReporter = path.join(__dirname, 'mobile_spec', 'jasmine-jsreporter.js');
-
-module.exports = function(output_location, sha, devices, entry_point, callback) {
- var tempAll = path.join(output_location, 'autotest', 'pages', 'all.html');
- // copy jasmine reporter into output_location location
- shell.cp('-Rf', jasmineReporter, output_location);
-
- // drop sha to the top of the jasmine reporter
- var tempJasmine = path.join(output_location, 'jasmine-jsreporter.js');
-console.log('Mobilespec Jasmine - path:'+tempJasmine);
- fs.writeFileSync(tempJasmine, "var mobile_spec_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
-
- // replace a few lines under the "all" tests autopage
-console.log('Mobilespec All - path:'+tempAll);
- fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/<script type=.text.javascript. src=.\.\..html.TrivialReporter\.js.><.script>/, '<script type="text/javascript" src="../html/TrivialReporter.js"></script><script type="text/javascript" src="../../jasmine-jsreporter.js"></script>'), 'utf-8');
- fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/jasmine.HtmlReporter.../, 'jasmine.HtmlReporter(); var jr = new jasmine.JSReporter("' + config.couchdb.host + '");'), 'utf-8');
- fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/addReporter.htmlReporter../, 'addReporter(htmlReporter);jasmineEnv.addReporter(jr);'), 'utf-8');
- callback();
-}
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/src/build/makers/windows.js
----------------------------------------------------------------------
diff --git a/src/build/makers/windows.js b/src/build/makers/windows.js
index aa4a1cb..9c9bc22 100644
--- a/src/build/makers/windows.js
+++ b/src/build/makers/windows.js
@@ -1,12 +1,11 @@
var shell = require('shelljs'),
path = require('path'),
fs = require('fs'),
- mspec = require('./mobile_spec'),
q = require('q'),
testRunner = require('./testRunner'),
util = require('util');
-module.exports = function (output, sha, entry_point, test_timeout, build_target) {
+module.exports = function (output, sha, test_timeout, build_target) {
var target_folder = ((build_target === 'store') ? 'windows' : ((build_target === 'store80') ? 'windows80' : 'phone')),
noBuildMarker = '<!-- no build marker -->',
@@ -62,39 +61,21 @@ module.exports = function (output, sha, entry_point, test_timeout, build_target)
function prepareMobileSpec() {
// make sure windows app got created first.
- var defer = q.defer(),
- mspec_out = path.join(output, 'www');
- try {
- if (!fs.existsSync(output)) {
- throw new Error('create must have failed as output path does not exist.');
- }
-
- log('Modifying Cordova Mobilespec application at:' + mspec_out);
-
- mspec(mspec_out, sha, '', entry_point, function (err) {
- if (err) {
- throw new Error('Error while modifying Windows mobile spec application.');
- }
-
- // patch WindowsStoreAppUtils script to allow app run w/out active desktop/remote session
- if (build_target === "win") {
- log('Patching WindowsStoreAppUtils to allow app to be run in automated mode');
- shell.cp('-f', path.join(output, '..', '..', '..', 'medic', 'src', 'utils', 'EnableDebuggingForPackage.ps1'),
- path.join(output, 'cordova', 'lib'));
- shell.sed('-i', /^\s*\$appActivator .*$/gim,
- '$&\n' +
- ' powershell ' + path.join(output, 'cordova', 'lib', 'EnableDebuggingForPackage.ps1') + ' $$ID\n' +
- ' $Ole32 = Add-Type -MemberDefinition \'[DllImport("Ole32.dll")]public static extern int CoAllowSetForegroundWindow(IntPtr pUnk, IntPtr lpvReserved);\' -Name \'Ole32\' -Namespace \'Win32\' -PassThru\n' +
- ' $Ole32::CoAllowSetForegroundWindow([System.Runtime.InteropServices.Marshal]::GetIUnknownForObject($appActivator), [System.IntPtr]::Zero)',
- path.join(output, 'cordova', 'lib', 'WindowsStoreAppUtils.ps1'));
- }
-
- defer.resolve();
- });
- } catch (e) {
- defer.reject(e);
+ if (!fs.existsSync(output)) {
+ throw new Error('create must have failed as output path does not exist.');
+ }
+ // patch WindowsStoreAppUtils script to allow app run w/out active desktop/remote session
+ if (build_target === "win") {
+ log('Patching WindowsStoreAppUtils to allow app to be run in automated mode');
+ shell.cp('-f', path.join(output, '..', '..', '..', 'medic', 'src', 'utils', 'EnableDebuggingForPackage.ps1'),
+ path.join(output, 'cordova', 'lib'));
+ shell.sed('-i', /^\s*\$appActivator .*$/gim,
+ '$&\n' +
+ ' powershell ' + path.join(output, 'cordova', 'lib', 'EnableDebuggingForPackage.ps1') + ' $$ID\n' +
+ ' $Ole32 = Add-Type -MemberDefinition \'[DllImport("Ole32.dll")]public static extern int CoAllowSetForegroundWindow(IntPtr pUnk, IntPtr lpvReserved);\' -Name \'Ole32\' -Namespace \'Win32\' -PassThru\n' +
+ ' $Ole32::CoAllowSetForegroundWindow([System.Runtime.InteropServices.Marshal]::GetIUnknownForObject($appActivator), [System.IntPtr]::Zero)',
+ path.join(output, 'cordova', 'lib', 'WindowsStoreAppUtils.ps1'));
}
- return defer.promise;
}
function build() {
@@ -114,11 +95,11 @@ module.exports = function (output, sha, entry_point, test_timeout, build_target)
}
}
- return prepareMobileSpec()
- .then(function () {
- shell.cd(path.join(output, '..', '..'));
- return build();
- }).then(run).then(function () {
+ prepareMobileSpec();
+ shell.cd(path.join(output, '..', '..'));
+ build();
+
+ return run().then(function () {
return testRunner.waitTestsCompleted(sha, 1000 * test_timeout);
}).then(testNoBuild);
};
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/eb060496/src/build/makers/wp8.js
----------------------------------------------------------------------
diff --git a/src/build/makers/wp8.js b/src/build/makers/wp8.js
index b302473..bc14987 100644
--- a/src/build/makers/wp8.js
+++ b/src/build/makers/wp8.js
@@ -1,11 +1,10 @@
var shell = require('shelljs'),
path = require('path'),
fs = require('fs'),
- mspec = require('./mobile_spec'),
q = require('q'),
testRunner = require('./testRunner');
-module.exports = function (output, sha, devices, entry_point, test_timeout, callback) {
+module.exports = function (output, sha, devices, test_timeout) {
function log(msg) {
console.log('[WP8] ' + msg + ' (sha: ' + sha + ')');
@@ -15,7 +14,7 @@ module.exports = function (output, sha, devices, entry_point, test_timeout, call
var cmd = 'cd ' + path + '\\..\\..\\ && node ..\\cordova-cli\\bin\\cordova run',
defer = q.defer();
// run option: --device, --emulator, other
- if (devices !== '') {
+ if (devices && devices !== '') {
cmd += ' --' + devices;
}
cmd += ' wp8';
@@ -32,58 +31,33 @@ module.exports = function (output, sha, devices, entry_point, test_timeout, call
function prepareMobileSpec() {
// make sure wp8 app got created first.
- var defer = q.defer(),
- mspec_out = path.join(output, 'www');
- try {
- if (!fs.existsSync(output)) {
- throw new Error('create must have failed as output path does not exist.');
- }
-
- log('Modifying Cordova Mobilespec application at: ' + mspec_out);
- mspec(mspec_out, sha, devices, entry_point, function (err) {
- if (err) {
- throw new Error('Error thrown modifying WP8 mobile spec application.');
- }
-
- log('Modifying Cordova wp8 application.');
- // add the sha to the junit reporter
- var tempJasmine = path.join(output, 'www', 'jasmine-jsreporter.js');
- if (fs.existsSync(tempJasmine)) {
- fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
- }
-
- // set permanent guid to prevent multiple installations
- var guid = '{8449DEEE-16EB-4A4A-AFCC-8446E8F06FF7}',
- appManifestXml = path.join(output, 'Properties', 'WMAppManifest.xml'),
- xml = fs.readFileSync(appManifestXml).toString().split('\n');
- for (var i in xml) if (xml[i].indexOf('<App') != -1) {
- if (xml[i].toLowerCase().indexOf('productid') != -1) {
- var index = xml[i].toLowerCase().indexOf('productid');
- var spaceIndex = xml[i].indexOf(' ', index);
- var stringAsArray = xml[i].split('');
- stringAsArray.splice(index, spaceIndex - index);
- xml[i] = stringAsArray.join('');
- }
- xml[i] = xml[i].substr(0, xml[i].length - 1);
- xml[i] += ' ProductID="' + guid + '">';
- break;
- }
- fs.writeFileSync(appManifestXml, xml.join('\n'));
-
- defer.resolve();
- });
- }
- catch (e) {
- defer.reject(e);
+ if (!fs.existsSync(output)) {
+ throw new Error('create must have failed as output path does not exist.');
}
- return defer.promise;
+ // set permanent guid to prevent multiple installations
+ var guid = '{8449DEEE-16EB-4A4A-AFCC-8446E8F06FF7}',
+ appManifestXml = path.join(output, 'Properties', 'WMAppManifest.xml'),
+ xml = fs.readFileSync(appManifestXml).toString().split('\n');
+ for (var i in xml) if (xml[i].indexOf('<App') != -1) {
+ if (xml[i].toLowerCase().indexOf('productid') != -1) {
+ var index = xml[i].toLowerCase().indexOf('productid');
+ var spaceIndex = xml[i].indexOf(' ', index);
+ var stringAsArray = xml[i].split('');
+ stringAsArray.splice(index, spaceIndex - index);
+ xml[i] = stringAsArray.join('');
+ }
+ xml[i] = xml[i].substr(0, xml[i].length - 1);
+ xml[i] += ' ProductID="' + guid + '">';
+ break;
+ }
+ fs.writeFileSync(appManifestXml, xml.join('\n'));
}
- return prepareMobileSpec()
+ prepareMobileSpec();
+
+ return deploy(output, sha, devices)
.then(function() {
- return deploy(output, sha, devices);
- }).then(function() {
return testRunner.waitTestsCompleted(sha, 1000 * test_timeout);
});
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org