You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/14 22:57:47 UTC
[7/7] cordova-windows git commit: CB-12895 : setup eslint and removed
jshint
CB-12895 : setup eslint and removed jshint
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/a8692238
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/a8692238
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/a8692238
Branch: refs/heads/master
Commit: a869223824f6ee1a6fc515d4b4aaafc2d8cfba93
Parents: 1c00f04
Author: Audrey So <au...@apache.org>
Authored: Fri Jun 9 13:46:56 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 14 15:48:15 2017 -0700
----------------------------------------------------------------------
.eslintignore | 3 +
.eslintrc.yml | 10 +
.jshintignore | 3 -
.jshintrc | 10 -
.travis.yml | 2 +-
bin/lib/check_reqs.js | 277 +-
bin/lib/create.js | 38 +-
bin/lib/update.js | 15 +-
package.json | 12 +-
spec/.eslintrc.yml | 2 +
spec/.jshintrc | 11 -
spec/e2e/endtoend.spec.js | 146 +-
spec/unit/AppxManifest.spec.js | 15 +-
spec/unit/ConfigChanges.spec.js | 151 +-
spec/unit/JsprojManager.spec.js | 2 +-
spec/unit/MSBuildTools.spec.js | 86 +-
spec/unit/Prepare.Win10.spec.js | 244 +-
spec/unit/Version.spec.js | 24 +-
spec/unit/WindowsConfigParser.spec.js | 17 +-
spec/unit/build.spec.js | 384 +--
spec/unit/check_reqs.spec.js | 64 +-
spec/unit/clean.spec.js | 39 +-
spec/unit/deployment.spec.js | 282 +-
spec/unit/package.spec.js | 132 +-
spec/unit/pluginHandler/common.spec.js | 44 +-
spec/unit/pluginHandler/windows.spec.js | 164 +-
spec/unit/run.spec.js | 234 +-
template/cordova/Api.js | 60 +-
template/cordova/lib/AppxManifest.js | 158 +-
template/cordova/lib/ConfigChanges.js | 31 +-
template/cordova/lib/ConfigParser.js | 84 +-
template/cordova/lib/JsprojManager.js | 130 +-
template/cordova/lib/MRTImage.js | 2 +-
template/cordova/lib/MSBuildTools.js | 83 +-
template/cordova/lib/PluginHandler.js | 62 +-
template/cordova/lib/PluginInfo.js | 37 +-
template/cordova/lib/Version.js | 48 +-
template/cordova/lib/build.js | 322 +-
template/cordova/lib/clean.js | 10 +-
template/cordova/lib/deployment.js | 86 +-
template/cordova/lib/log.js | 136 +-
template/cordova/lib/loggingHelper.js | 2 +-
template/cordova/lib/package.js | 155 +-
template/cordova/lib/prepare.js | 193 +-
template/cordova/lib/run.js | 60 +-
template/cordova/lib/target-list.js | 10 +-
template/cordova/lib/utils.js | 18 +-
template/cordova/prebuild.js | 4 +-
template/www/cordova.js | 4238 +++++++++++++-------------
template/www/js/index.js | 10 +-
50 files changed, 4122 insertions(+), 4228 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/.eslintignore
----------------------------------------------------------------------
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..065022a
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,3 @@
+**/dummer.js
+**/faultyPlugin.js
+**/dummyplugin.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+ indent:
+ - error
+ - 4
+ camelcase: off
+ padded-blocks: off
+ operator-linebreak: off
+ no-throw-literal: off
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/.jshintignore
----------------------------------------------------------------------
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index 451e6d3..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-template/www/*
-template/WinJS/*
-spec/unit/fixtures/*
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 89a121c..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "node": true
- , "bitwise": true
- , "undef": true
- , "trailing": true
- , "quotmark": true
- , "indent": 4
- , "unused": "vars"
- , "latedef": "nofunc"
-}
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d0be3b6..119ba5e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ install:
- npm install
- npm install -g codecov
script:
- - npm run jshint
+ - npm run eslint
- npm run cover
after_script:
- codecov
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index dd41b81..792cec3 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -17,11 +17,9 @@
under the License.
*/
-/*jshint node:true*/
-
-var Q = require('q');
-var os = require('os');
-var path = require('path');
+var Q = require('q');
+var os = require('os');
+var path = require('path');
var shell = require('shelljs');
var spawn = require('cordova-common').superspawn.spawn;
var CordovaError = require('cordova-common').CordovaError;
@@ -63,7 +61,6 @@ var REQUIRED_VERSIONS = {
};
function getMinimalRequiredVersionFor (requirement, windowsTargetVersion, windowsPhoneTargetVersion) {
-
if (windowsTargetVersion === '8' || windowsTargetVersion === '8.0') {
throw new CordovaError('windows8 platform is deprecated. To use windows-target-version=8.0 you may downgrade to cordova-windows@4.');
}
@@ -81,9 +78,9 @@ function getMinimalRequiredVersionFor (requirement, windowsTargetVersion, window
// If both windowsReqVersion and phoneReqVersion is valid Versions, choose the max one
if (windowsReqVersion && phoneReqVersion) {
- return windowsReqVersion.gt(phoneReqVersion) ?
- windowsReqVersion :
- phoneReqVersion;
+ return windowsReqVersion.gt(phoneReqVersion)
+ ? windowsReqVersion
+ : phoneReqVersion;
}
// Otherwise return that one which is defined and valid
@@ -94,10 +91,10 @@ function getHighestAppropriateVersion (versions, requiredVersion) {
return versions.map(function (version) {
return Version.tryParse(version);
})
- .sort(Version.comparer)
- .filter(function (toolVersion) {
- return toolVersion.gte(requiredVersion);
- })[0];
+ .sort(Version.comparer)
+ .filter(function (toolVersion) {
+ return toolVersion.gte(requiredVersion);
+ })[0];
}
/**
@@ -106,7 +103,7 @@ function getHighestAppropriateVersion (versions, requiredVersion) {
*
* @return {Version} Version information for current OS.
*/
-function getWindowsVersion() {
+function getWindowsVersion () {
return spawn('ver').then(function (output) {
var match = /\[Version (.*)\]\s*$/.exec(output);
return Version.fromString(match[1]);
@@ -121,39 +118,36 @@ function getWindowsVersion() {
*
* @return {String[]} List of installed Visual Studio versions.
*/
-function getInstalledVSVersions() {
+function getInstalledVSVersions () {
// Query all keys with Install value equal to 1, then filter out
// those, which are not related to VS itself
return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\DevDiv\\vs\\Servicing', '/s', '/v', 'Install', '/f', '1', '/d', '/e', '/reg:32'])
- .fail(function () { return ''; })
- .then(function (output) {
- return output.split('\n')
- .reduce(function (installedVersions, line) {
- var match = /(\d+\.\d+)\\(ultimate|professional|premium|community)/.exec(line);
- if (match && match[1] && installedVersions.indexOf(match[1]) === -1)
- installedVersions.push(match[1]);
- return installedVersions;
- }, []);
- })
- .then(function (installedVersions) {
- // If there is no VS2013 installed, the we have nothing to do
- if (installedVersions.indexOf('12.0') === -1) return installedVersions;
-
- // special case for VS 2013. We need to check if VS2013 update 2 is installed
- return spawn('reg', ['query','HKLM\\SOFTWARE\\Microsoft\\Updates\\Microsoft Visual Studio 2013\\vsupdate_KB2829760','/v','PackageVersion','/reg:32'])
+ .fail(function () { return ''; })
.then(function (output) {
- var updateVer = Version.fromString(/PackageVersion\s+REG_SZ\s+(.*)/i.exec(output)[1]);
- // if update version is lover than Update2, reject the promise
- if (VS2013_UPDATE2_RC.gte(updateVer)) return Q.reject();
- return installedVersions;
- })
- .fail(function () {
- // if we got any errors on previous steps, we're assuming that
- // required VS update is not installed.
- installedVersions.splice(installedVersions.indexOf('12.0'), 1);
- return installedVersions;
+ return output.split('\n')
+ .reduce(function (installedVersions, line) {
+ var match = /(\d+\.\d+)\\(ultimate|professional|premium|community)/.exec(line);
+ if (match && match[1] && installedVersions.indexOf(match[1]) === -1) { installedVersions.push(match[1]); }
+ return installedVersions;
+ }, []);
+ }).then(function (installedVersions) {
+ // If there is no VS2013 installed, the we have nothing to do
+ if (installedVersions.indexOf('12.0') === -1) return installedVersions;
+
+ // special case for VS 2013. We need to check if VS2013 update 2 is installed
+ return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Updates\\Microsoft Visual Studio 2013\\vsupdate_KB2829760', '/v', 'PackageVersion', '/reg:32'])
+ .then(function (output) {
+ var updateVer = Version.fromString(/PackageVersion\s+REG_SZ\s+(.*)/i.exec(output)[1]);
+ // if update version is lover than Update2, reject the promise
+ if (VS2013_UPDATE2_RC.gte(updateVer)) return Q.reject();
+ return installedVersions;
+ }).fail(function () {
+ // if we got any errors on previous steps, we're assuming that
+ // required VS update is not installed.
+ installedVersions.splice(installedVersions.indexOf('12.0'), 1);
+ return installedVersions;
+ });
});
- });
}
/**
@@ -163,20 +157,19 @@ function getInstalledVSVersions() {
*/
function getInstalledWindowsSdks () {
var installedSdks = [];
- return spawn('reg', ['query','HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows','/s','/v','InstallationFolder','/reg:32'])
- .fail(function () { return ''; })
- .then(function (output) {
- var re = /\\Microsoft SDKs\\Windows\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim;
- var match;
- while ((match = re.exec(output))){
- var sdkPath = match[2];
- // Verify that SDKs is really installed by checking SDKManifest file at SDK root
- if (shell.test('-e', path.join(sdkPath, 'SDKManifest.xml'))) {
- installedSdks.push(Version.tryParse(match[1]));
+ return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows', '/s', '/v', 'InstallationFolder', '/reg:32'])
+ .fail(function () { return ''; })
+ .then(function (output) {
+ var re = /\\Microsoft SDKs\\Windows\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim;
+ var match;
+ while ((match = re.exec(output))) {
+ var sdkPath = match[2];
+ // Verify that SDKs is really installed by checking SDKManifest file at SDK root
+ if (shell.test('-e', path.join(sdkPath, 'SDKManifest.xml'))) {
+ installedSdks.push(Version.tryParse(match[1]));
+ }
}
- }
- })
- .thenResolve(installedSdks);
+ }).thenResolve(installedSdks);
}
/**
@@ -188,25 +181,23 @@ function getInstalledWindowsSdks () {
*/
function getInstalledPhoneSdks () {
var installedSdks = [];
- return spawn('reg', ['query','HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows Phone\\v8.1','/v','InstallationFolder','/reg:32'])
- .fail(function () { return ''; })
- .then(function (output) {
- var match = /\\Microsoft SDKs\\Windows Phone\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim.exec(output);
- if (match && shell.test('-e', path.join(match[2], 'SDKManifest.xml'))) {
- installedSdks.push(Version.tryParse(match[1]));
- }
- })
- .then(function () {
- return spawn('reg', ['query','HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0','/v','InstallationFolder','/reg:32']);
- })
- .fail(function () { return ''; })
- .then(function (output) {
- var match = /\\Microsoft SDKs\\Windows\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim.exec(output);
- if (match && shell.test('-e', path.join(match[2], 'SDKManifest.xml'))) {
- installedSdks.push(Version.tryParse(match[1]));
- }
- })
- .thenResolve(installedSdks);
+ return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows Phone\\v8.1', '/v', 'InstallationFolder', '/reg:32'])
+ .fail(function () { return ''; })
+ .then(function (output) {
+ var match = /\\Microsoft SDKs\\Windows Phone\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim.exec(output);
+ if (match && shell.test('-e', path.join(match[2], 'SDKManifest.xml'))) {
+ installedSdks.push(Version.tryParse(match[1]));
+ }
+ }).then(function () {
+ return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0', '/v', 'InstallationFolder', '/reg:32']);
+ }).fail(function () {
+ return '';
+ }).then(function (output) {
+ var match = /\\Microsoft SDKs\\Windows\\v(\d+\.\d+)\s*InstallationFolder\s+REG_SZ\s+(.*)/gim.exec(output);
+ if (match && shell.test('-e', path.join(match[2], 'SDKManifest.xml'))) {
+ installedSdks.push(Version.tryParse(match[1]));
+ }
+ }).thenResolve(installedSdks);
}
/**
@@ -221,7 +212,7 @@ function shortenVersion (version) {
return /^(\d+(?:\.\d+)?)/.exec(version.toString())[1];
}
-function mapWindowsVersionToName(version) {
+function mapWindowsVersionToName (version) {
var map = {
'6.2': 'Windows 8',
'6.3': 'Windows 8.1',
@@ -231,7 +222,7 @@ function mapWindowsVersionToName(version) {
return map[majorMinor];
}
-function mapVSVersionToName(version) {
+function mapVSVersionToName (version) {
var map = {
'11.0': '2012 Express for Windows',
'12.0': '2013 Express for Windows Update2',
@@ -253,9 +244,9 @@ var checkOS = function (windowsTargetVersion, windowsPhoneTargetVersion) {
return getWindowsVersion().then(function (actualVersion) {
var requiredOsVersion = getMinimalRequiredVersionFor('os', windowsTargetVersion, windowsPhoneTargetVersion);
- if (actualVersion.gte(requiredOsVersion) ||
+ if ((actualVersion.gte(requiredOsVersion)) ||
// Special case for Windows 10/Phone 10 targets which can be built on Windows 7 (version 6.1)
- actualVersion.major === 6 && actualVersion.minor === 1 && getConfig().getWindowsTargetVersion() === '10.0') {
+ (actualVersion.major === 6 && actualVersion.minor === 1 && getConfig().getWindowsTargetVersion() === '10.0')) {
return mapWindowsVersionToName(actualVersion);
}
@@ -271,71 +262,71 @@ var checkOS = function (windowsTargetVersion, windowsPhoneTargetVersion) {
*/
var checkMSBuild = function (windowsTargetVersion, windowsPhoneTargetVersion) {
return MSBuildTools.findAllAvailableVersions()
- .then(function (msbuildToolsVersions) {
- var msbuildRequiredVersion = getMinimalRequiredVersionFor('msbuild', windowsTargetVersion, windowsPhoneTargetVersion);
- msbuildToolsVersions = msbuildToolsVersions.map(function (msbuildToolsVersion) {
- return msbuildToolsVersion.version;
- });
+ .then(function (msbuildToolsVersions) {
+ var msbuildRequiredVersion = getMinimalRequiredVersionFor('msbuild', windowsTargetVersion, windowsPhoneTargetVersion);
+ msbuildToolsVersions = msbuildToolsVersions.map(function (msbuildToolsVersion) {
+ return msbuildToolsVersion.version;
+ });
- var appropriateVersion = getHighestAppropriateVersion(msbuildToolsVersions, msbuildRequiredVersion);
- return appropriateVersion ?
- shortenVersion(appropriateVersion) :
- Q.reject('MSBuild tools v.' + shortenVersion(msbuildRequiredVersion) + ' not found. ' +
- 'Please install Visual Studio ' + mapVSVersionToName(getMinimalRequiredVersionFor('visualstudio', windowsTargetVersion, windowsPhoneTargetVersion)) +
- ' from https://www.visualstudio.com/downloads/download-visual-studio-vs');
- });
+ var appropriateVersion = getHighestAppropriateVersion(msbuildToolsVersions, msbuildRequiredVersion);
+ return appropriateVersion
+ ? shortenVersion(appropriateVersion)
+ : Q.reject('MSBuild tools v.' + shortenVersion(msbuildRequiredVersion) + ' not found. ' +
+ 'Please install Visual Studio ' + mapVSVersionToName(getMinimalRequiredVersionFor('visualstudio', windowsTargetVersion, windowsPhoneTargetVersion)) +
+ ' from https://www.visualstudio.com/downloads/download-visual-studio-vs');
+ });
};
var checkVS = function (windowsTargetVersion, windowsPhoneTargetVersion) {
var vsRequiredVersion = getMinimalRequiredVersionFor('visualstudio', windowsTargetVersion, windowsPhoneTargetVersion);
return getInstalledVSVersions()
- .then(function (installedVersions) {
- var appropriateVersion = getHighestAppropriateVersion(installedVersions, vsRequiredVersion);
- return appropriateVersion ?
- shortenVersion(appropriateVersion) :
- Q.reject('Required version of Visual Studio not found. Please install Visual Studio ' +
- mapVSVersionToName(vsRequiredVersion) +
- ' from https://www.visualstudio.com/downloads/download-visual-studio-vs');
- });
+ .then(function (installedVersions) {
+ var appropriateVersion = getHighestAppropriateVersion(installedVersions, vsRequiredVersion);
+ return appropriateVersion
+ ? shortenVersion(appropriateVersion)
+ : Q.reject('Required version of Visual Studio not found. Please install Visual Studio ' +
+ mapVSVersionToName(vsRequiredVersion) +
+ ' from https://www.visualstudio.com/downloads/download-visual-studio-vs');
+ });
};
var checkWinSdk = function (windowsTargetVersion, windowsPhoneTargetVersion) {
return getInstalledWindowsSdks()
- .then(function (installedSdks) {
- var requiredVersion = getMinimalRequiredVersionFor('windowssdk', windowsTargetVersion, windowsPhoneTargetVersion);
- var hasSdkInstalled = installedSdks.some(function (installedSdk) {
- return installedSdk.eq(requiredVersion);
- });
- if (!hasSdkInstalled) {
- return Q.reject('Windows SDK not found. Ensure that you have installed ' +
- 'Windows ' + shortenVersion(requiredVersion) + ' SDK along with Visual Studio or install ' +
- 'Windows ' + shortenVersion(requiredVersion) + ' SDK separately from ' +
- 'https://dev.windows.com/en-us/downloads');
- }
+ .then(function (installedSdks) {
+ var requiredVersion = getMinimalRequiredVersionFor('windowssdk', windowsTargetVersion, windowsPhoneTargetVersion);
+ var hasSdkInstalled = installedSdks.some(function (installedSdk) {
+ return installedSdk.eq(requiredVersion);
+ });
+ if (!hasSdkInstalled) {
+ return Q.reject('Windows SDK not found. Ensure that you have installed ' +
+ 'Windows ' + shortenVersion(requiredVersion) + ' SDK along with Visual Studio or install ' +
+ 'Windows ' + shortenVersion(requiredVersion) + ' SDK separately from ' +
+ 'https://dev.windows.com/en-us/downloads');
+ }
- return shortenVersion(requiredVersion);
- });
+ return shortenVersion(requiredVersion);
+ });
};
var checkPhoneSdk = function (windowsTargetVersion, windowsPhoneTargetVersion) {
var requiredVersion = getMinimalRequiredVersionFor('phonesdk', windowsTargetVersion, windowsPhoneTargetVersion);
return getInstalledPhoneSdks()
- .then(function (installedSdks) {
- var hasSdkInstalled = installedSdks.some(function (installedSdk) {
- return installedSdk.eq(requiredVersion);
- });
+ .then(function (installedSdks) {
+ var hasSdkInstalled = installedSdks.some(function (installedSdk) {
+ return installedSdk.eq(requiredVersion);
+ });
- return hasSdkInstalled ?
- shortenVersion(requiredVersion) :
- Q.reject();
- })
- .fail(function () {
- return Q.reject('Windows Phone SDK not found. Ensure that you have installed ' +
- 'Windows Phone ' + shortenVersion(requiredVersion) + ' SDK along with Visual Studio or install ' +
- 'Windows Phone ' + shortenVersion(requiredVersion) + ' SDK separately from ' +
- 'https://dev.windows.com/develop/download-phone-sdk');
- });
+ return hasSdkInstalled
+ ? shortenVersion(requiredVersion)
+ : Q.reject();
+ })
+ .fail(function () {
+ return Q.reject('Windows Phone SDK not found. Ensure that you have installed ' +
+ 'Windows Phone ' + shortenVersion(requiredVersion) + ' SDK along with Visual Studio or install ' +
+ 'Windows Phone ' + shortenVersion(requiredVersion) + ' SDK separately from ' +
+ 'https://dev.windows.com/develop/download-phone-sdk');
+ });
};
module.exports.run = function () {
@@ -383,7 +374,7 @@ var requirements = [
var checkFns = [checkOS, checkMSBuild, checkVS, checkWinSdk, checkPhoneSdk];
var config = null;
-function getConfig() {
+function getConfig () {
try {
config = config || new ConfigParser(path.join(__dirname, '../../config.xml'));
return Q(config);
@@ -398,8 +389,7 @@ function getConfig() {
* as an array of Requirement objects. This method intended to be used by cordova-lib check_reqs method.
* @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled.
*/
-module.exports.check_all = function() {
-
+module.exports.check_all = function () {
var result = [];
var fatalIsHit = false;
@@ -411,25 +401,24 @@ module.exports.check_all = function() {
if (fatalIsHit) return Q();
var requirement = requirements[idx];
return getConfig()
- .then(function (config) {
- return checkFn(config.getWindowsTargetVersion(), config.getWindowsPhoneTargetVersion())
- .then(function (version) {
- requirement.installed = true;
- requirement.metadata.version = version;
- result.push(requirement);
- }).catch( function (err) {
- if (requirement.isFatal) fatalIsHit = true;
- requirement.metadata.reason = err;
- result.push(requirement);
+ .then(function (config) {
+ return checkFn(config.getWindowsTargetVersion(), config.getWindowsPhoneTargetVersion())
+ .then(function (version) {
+ requirement.installed = true;
+ requirement.metadata.version = version;
+ result.push(requirement);
+ }).catch(function (err) {
+ if (requirement.isFatal) fatalIsHit = true;
+ requirement.metadata.reason = err;
+ result.push(requirement);
+ });
});
- });
-
});
}, Q())
- .then(function () {
- // When chain is completed, return requirements array to upstream API
- return result;
- });
+ .then(function () {
+ // When chain is completed, return requirements array to upstream API
+ return result;
+ });
};
module.exports.help = function () {
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 08c5156..975fc35 100644
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -17,11 +17,11 @@
under the License.
*/
-var Q = require('q');
-var fs = require('fs');
-var path = require('path');
+var Q = require('q');
+var fs = require('fs');
+var path = require('path');
var shell = require('shelljs');
-var uuid = require('node-uuid');
+var uuid = require('node-uuid');
var events = require('cordova-common').events;
var CordovaError = require('cordova-common').CordovaError;
var AppxManifest = require('../../template/cordova/lib/AppxManifest');
@@ -29,7 +29,7 @@ var pkg = require('../../package');
// Creates cordova-windows project at specified path with specified namespace, app name and GUID
module.exports.create = function (destinationDir, config, options) {
- if(!destinationDir) return Q.reject('No destination directory specified.');
+ if (!destinationDir) return Q.reject('No destination directory specified.');
var projectPath = path.resolve(destinationDir);
if (fs.existsSync(projectPath)) {
@@ -39,8 +39,8 @@ module.exports.create = function (destinationDir, config, options) {
// Set parameters/defaults for create
var packageName = (config && config.packageName()) || 'Cordova.Example';
var appName = (config && config.name()) || 'CordovaAppProj';
- // 64 symbols restriction goes from manifest schema definition
- // http://msdn.microsoft.com/en-us/library/windows/apps/br211415.aspx
+ // 64 symbols restriction goes from manifest schema definition
+ // http://msdn.microsoft.com/en-us/library/windows/apps/br211415.aspx
var safeAppName = appName.length <= 64 ? appName : appName.substr(0, 64);
var templateOverrides = options.customTemplate;
var guid = options.guid || uuid.v1();
@@ -99,17 +99,17 @@ module.exports.create = function (destinationDir, config, options) {
// replace specific values in manifests' templates
events.emit('verbose', 'Updating manifest files with project configuration.');
[ 'package.windows.appxmanifest', 'package.phone.appxmanifest',
- 'package.windows10.appxmanifest' ]
- .forEach(function (item) {
- var manifest = AppxManifest.get(path.join(projectPath, item));
- if (manifest.hasPhoneIdentity) {
- manifest.getPhoneIdentity().setPhoneProductId(guid);
- }
-
- manifest.setPackageName(packageName)
- .setAppName(safeAppName)
- .write();
- });
+ 'package.windows10.appxmanifest' ]
+ .forEach(function (item) {
+ var manifest = AppxManifest.get(path.join(projectPath, item));
+ if (manifest.hasPhoneIdentity) {
+ manifest.getPhoneIdentity().setPhoneProductId(guid);
+ }
+
+ manifest.setPackageName(packageName)
+ .setAppName(safeAppName)
+ .write();
+ });
// Delete bld forder and bin folder
['bld', 'bin', '*.user', '*.suo', 'MyTemplate.vstemplate'].forEach(function (file) {
@@ -120,7 +120,7 @@ module.exports.create = function (destinationDir, config, options) {
return Q.resolve();
};
-function recursiveCreateDirectory(targetPath, previousPath) {
+function recursiveCreateDirectory (targetPath, previousPath) {
if (previousPath === targetPath) {
// Shouldn't ever happen because we're already in a created directory
// This is just here to prevent any potential infinite loop / stack overflow condition
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/bin/lib/update.js
----------------------------------------------------------------------
diff --git a/bin/lib/update.js b/bin/lib/update.js
index cb80f9c..68ff26c 100644
--- a/bin/lib/update.js
+++ b/bin/lib/update.js
@@ -17,10 +17,10 @@
under the License.
*/
-var Q = require('q');
-var fs = require('fs');
-var path = require('path');
-var shell = require('shelljs');
+var Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
var create = require('./create');
var events = require('cordova-common').events;
var ConfigParser = require('cordova-common').ConfigParser;
@@ -29,13 +29,13 @@ var AppxManifest = require('../../template/cordova/lib/AppxManifest');
// updates the cordova.js in project along with the cordova tooling.
module.exports.update = function (destinationDir, options) {
- if (!fs.existsSync(destinationDir)){
+ if (!fs.existsSync(destinationDir)) {
// if specified project path is not valid then reject promise
return Q.reject(new CordovaError('The given path to the project does not exist: ' + destinationDir));
}
var projectConfig = path.join(destinationDir, 'config.xml');
- if (!fs.existsSync(projectConfig)){
+ if (!fs.existsSync(projectConfig)) {
return Q.reject(new CordovaError('Can\'t update project at ' + destinationDir +
'. config.xml does not exist in destination directory'));
}
@@ -50,9 +50,8 @@ module.exports.update = function (destinationDir, options) {
var manifestPath = path.join(destinationDir, 'package.phone.appxmanifest');
try {
guid = AppxManifest.get(manifestPath).getPhoneIdentity().getPhoneProductId();
- } catch (e) { /*ignore IO errors */ }
+ } catch (e) { /* ignore IO errors */ }
shell.rm('-rf', destinationDir);
return create.create(destinationDir, config, {guid: guid}, events);
};
-
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index d3ef3da..0a98e28 100644
--- a/package.json
+++ b/package.json
@@ -17,11 +17,11 @@
"apache"
],
"scripts": {
- "test": "npm run jshint && npm run test-unit && npm run test-e2e",
+ "test": "npm run eslint && npm run test-unit && npm run test-e2e",
"test-unit": "jasmine --captureExceptions ",
"test-e2e": "jasmine --captureExceptions spec/e2e/endtoend.spec.js",
"cover": "istanbul cover --root bin/templates/cordova --print detail jasmine",
- "jshint": "jshint bin && jshint template && jshint spec"
+ "eslint": "eslint bin && eslint template && eslint spec"
},
"dependencies": {
"cordova-common": "^2.0.0",
@@ -34,9 +34,15 @@
"winjs": "^4.4.0"
},
"devDependencies": {
+ "eslint": "^4.2.0",
+ "eslint-config-semistandard": "^11.0.0",
+ "eslint-config-standard": "^10.2.1",
+ "eslint-plugin-import": "^2.3.0",
+ "eslint-plugin-node": "^5.0.0",
+ "eslint-plugin-promise": "^3.5.0",
+ "eslint-plugin-standard": "^3.0.1",
"istanbul": "^0.4.0",
"jasmine": "^2.5.3",
- "jshint": "^2.8.0",
"rewire": "^2.5.1"
},
"bundledDependencies": [
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
new file mode 100644
index 0000000..6afba65
--- /dev/null
+++ b/spec/.eslintrc.yml
@@ -0,0 +1,2 @@
+env:
+ jasmine: true
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/.jshintrc
----------------------------------------------------------------------
diff --git a/spec/.jshintrc b/spec/.jshintrc
deleted file mode 100644
index 17eae32..0000000
--- a/spec/.jshintrc
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "node": true
- , "bitwise": true
- , "undef": true
- , "trailing": true
- , "quotmark": true
- , "indent": 4
- , "unused": "vars"
- , "latedef": "nofunc"
- , "jasmine": true
-}
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/e2e/endtoend.spec.js
----------------------------------------------------------------------
diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index 52f1cfa..1fb8cc5 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -16,9 +16,9 @@
specific language governing permissions and limitations
under the License.
*/
-var shell = require('shelljs'),
- fs = require('fs'),
- path = require('path');
+var shell = require('shelljs');
+var fs = require('fs');
+var path = require('path');
var FIXTURES = path.join(__dirname, '../unit/fixtures');
var EXTENSIONS_PLUGIN = 'org.test.plugins.extensionsplugin';
@@ -28,60 +28,60 @@ var templateFolder = path.join(__dirname, '../../template');
var Api = require(path.join(templateFolder, 'cordova/Api'));
var PluginInfo = require('cordova-common').PluginInfo;
-describe('Cordova create and build', function(){
+describe('Cordova create and build', function () {
- var projectFolder = 'testcreate 応用',
- buildDirectory = path.join(__dirname, '../..'),
- appPackagesFolder = path.join(buildDirectory, projectFolder, 'AppPackages'),
- buildScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'build') + '"';
+ var projectFolder = 'testcreate 応用';
+ var buildDirectory = path.join(__dirname, '../..');
+ var appPackagesFolder = path.join(buildDirectory, projectFolder, 'AppPackages');
+ var buildScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'build') + '"';
- function verifySubDirContainsFile(subDirName, fileName) {
+ function verifySubDirContainsFile (subDirName, fileName) {
var subDir = path.join(appPackagesFolder, subDirName);
var packages = shell.ls(subDir);
- expect(packages.filter(function(file) { return file.match(fileName); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(fileName); }).length).toBe(1);
}
- beforeEach(function(){
- shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', {silent : true});
+ beforeEach(function () {
+ shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', {silent: true});
});
- afterEach(function() {
+ afterEach(function () {
shell.cd(buildDirectory);
shell.rm('-rf', projectFolder);
});
- it('spec.1 should create new project', function(){
+ it('spec.1 should create new project', function () {
expect(fs.existsSync(projectFolder)).toBe(true);
});
- it('spec.2 should build project', function(){
- shell.exec(buildScriptPath, {silent:true});
+ it('spec.2 should build project', function () {
+ shell.exec(buildScriptPath, {silent: true});
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*\.appx.*/); }).length).toBe(1);
});
- it('spec.3 should build project for particular CPU', function(){
- shell.exec(buildScriptPath + ' --archs=\"x64\"', {silent : true});
+ it('spec.3 should build project for particular CPU', function () {
+ shell.exec(buildScriptPath + ' --archs=\"x64\"', {silent: true}); /* eslint no-useless-escape : 0 */
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*x64.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*x64.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*x64.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*x64.*\.appx.*/); }).length).toBe(1);
});
- it('spec.4 should build project for CPUs separated by whitespaces', function(){
- shell.exec(buildScriptPath + ' --archs=\"x64 x86 arm anycpu\"', {silent : true});
+ it('spec.4 should build project for CPUs separated by whitespaces', function () {
+ shell.exec(buildScriptPath + ' --archs=\"x64 x86 arm anycpu\"', {silent: true}); /* eslint no-useless-escape : 0 */
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*x86.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*x64.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*arm.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*AnyCPU.*\.appx.*/i); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*x64.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*x86.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*arm.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*anycpu.*\.appx.*/i); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*x86.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*x64.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*arm.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*AnyCPU.*\.appx.*/i); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*x64.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*x86.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*arm.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*anycpu.*\.appx.*/i); }).length).toBe(1);
});
- it('spec.5 should build project containing plugin with InProcessServer extension', function(done){
+ it('spec.5 should build project containing plugin with InProcessServer extension', function (done) {
var extensionsPluginInfo, api;
extensionsPluginInfo = new PluginInfo(extensionsPlugin);
@@ -91,66 +91,66 @@ describe('Cordova create and build', function(){
api.locations.www = path.join(projectFolder, 'www');
var fail = jasmine.createSpy('fail')
- .and.callFake(function (err) {
- console.error(err);
- });
+ .and.callFake(function (err) {
+ console.error(err);
+ });
api.addPlugin(extensionsPluginInfo)
- .then(function() {
- shell.exec(buildScriptPath, {silent:true});
- var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*Phone.*\.appx.*/); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(/.*Windows.*\.appx.*/); }).length).toBe(1);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ shell.exec(buildScriptPath, {silent: true});
+ var packages = shell.ls(appPackagesFolder);
+ expect(packages.filter(function (file) { return file.match(/.*Phone.*\.appx.*/); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(/.*Windows.*\.appx.*/); }).length).toBe(1);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.6 should generate appxupload and appxbundle for Windows 8.1 project bundle release build', function(){
- shell.exec(buildScriptPath + ' --release --win --bundle --archs=\"x64 x86 arm\"', {silent : true});
+ it('spec.6 should generate appxupload and appxbundle for Windows 8.1 project bundle release build', function () {
+ shell.exec(buildScriptPath + ' --release --win --bundle --archs=\"x64 x86 arm\"', {silent: true});
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*bundle\.appxupload$/); }).length > 0).toBeTruthy();
+ expect(packages.filter(function (file) { return file.match(/.*bundle\.appxupload$/); }).length > 0).toBeTruthy();
var bundleDirName = 'CordovaApp.Windows_1.0.0.0_Test';
- expect(packages.filter(function(file) { return file.match(bundleDirName); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(bundleDirName); }).length).toBe(1);
verifySubDirContainsFile(bundleDirName, 'CordovaApp.Windows_1.0.0.0_x64_x86_arm.appxbundle');
});
- it('spec.6.1 should generate appxupload for Windows 8.1 project non-bundle release build', function(){
- shell.exec(buildScriptPath + ' --release --win --archs=\"x64 x86 arm\"', {silent : true});
+ it('spec.6.1 should generate appxupload for Windows 8.1 project non-bundle release build', function () {
+ shell.exec(buildScriptPath + ' --release --win --archs=\"x64 x86 arm\"', {silent: true});
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*\.appxupload$/); }).length).toBe(3);
+ expect(packages.filter(function (file) { return file.match(/.*\.appxupload$/); }).length).toBe(3);
});
- it('spec.7 should generate appxupload and appxbundle for Windows 10 project bundle release build', function(){
- shell.exec(buildScriptPath + ' --release --win --appx=uap --bundle --archs=\"x64 x86 arm\"', {silent : true});
+ it('spec.7 should generate appxupload and appxbundle for Windows 10 project bundle release build', function () {
+ shell.exec(buildScriptPath + ' --release --win --appx=uap --bundle --archs=\"x64 x86 arm\"', {silent: true});
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*bundle\.appxupload$/); }).length > 0).toBeTruthy();
+ expect(packages.filter(function (file) { return file.match(/.*bundle\.appxupload$/); }).length > 0).toBeTruthy();
var bundleDirName = 'CordovaApp.Windows10_1.0.0.0_Test';
- expect(packages.filter(function(file) { return file.match(bundleDirName); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(bundleDirName); }).length).toBe(1);
verifySubDirContainsFile(bundleDirName, 'CordovaApp.Windows10_1.0.0.0_x64_x86_arm.appxbundle');
});
- it('spec.7.1 should generate appxupload for Windows 10 project non-bundle release build', function(){
- shell.exec(buildScriptPath + ' --release --win --appx=uap --archs=\"x64 x86 arm\"', {silent : true});
+ it('spec.7.1 should generate appxupload for Windows 10 project non-bundle release build', function () {
+ shell.exec(buildScriptPath + ' --release --win --appx=uap --archs=\"x64 x86 arm\"', {silent: true});
var packages = shell.ls(appPackagesFolder);
- expect(packages.filter(function(file) { return file.match(/.*\.appxupload$/); }).length).toBe(3);
+ expect(packages.filter(function (file) { return file.match(/.*\.appxupload$/); }).length).toBe(3);
// CB-12416 Should build appx in separate dirs for each architecture
- var armSubDir = 'CordovaApp.Windows10_1.0.0.0_arm_Test',
- x64SubDir = 'CordovaApp.Windows10_1.0.0.0_x64_Test',
- x86SubDir = 'CordovaApp.Windows10_1.0.0.0_x86_Test';
+ var armSubDir = 'CordovaApp.Windows10_1.0.0.0_arm_Test';
+ var x64SubDir = 'CordovaApp.Windows10_1.0.0.0_x64_Test';
+ var x86SubDir = 'CordovaApp.Windows10_1.0.0.0_x86_Test';
// Should contain a subdirectory for each of the architectures
- expect(packages.filter(function(file) { return file.match(armSubDir); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(x64SubDir); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(x86SubDir); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(armSubDir); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(x64SubDir); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(x86SubDir); }).length).toBe(1);
// These subdirectories should contain corresponding appx files
verifySubDirContainsFile(armSubDir, 'CordovaApp.Windows10_1.0.0.0_arm.appx');
@@ -158,16 +158,16 @@ describe('Cordova create and build', function(){
verifySubDirContainsFile(x86SubDir, 'CordovaApp.Windows10_1.0.0.0_x86.appx');
});
- it('spec.8 for a non-bundle case for Windows Phone 8.1 it should build appx in separate dirs for each architecture', function(){
- shell.exec(buildScriptPath + ' --release --phone --archs=\"x86 arm\"', {silent : true});
+ it('spec.8 for a non-bundle case for Windows Phone 8.1 it should build appx in separate dirs for each architecture', function () {
+ shell.exec(buildScriptPath + ' --release --phone --archs=\"x86 arm\"', {silent: true});
var packages = shell.ls(appPackagesFolder);
- var armSubDir = 'CordovaApp.Phone_1.0.0.0_arm_Test',
- x86SubDir = 'CordovaApp.Phone_1.0.0.0_x86_Test';
+ var armSubDir = 'CordovaApp.Phone_1.0.0.0_arm_Test';
+ var x86SubDir = 'CordovaApp.Phone_1.0.0.0_x86_Test';
// Should contain a subdirectory for each of the architectures
- expect(packages.filter(function(file) { return file.match(armSubDir); }).length).toBe(1);
- expect(packages.filter(function(file) { return file.match(x86SubDir); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(armSubDir); }).length).toBe(1);
+ expect(packages.filter(function (file) { return file.match(x86SubDir); }).length).toBe(1);
// These subdirectories should contain corresponding appx files
verifySubDirContainsFile(armSubDir, 'CordovaApp.Phone_1.0.0.0_arm.appx');
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/AppxManifest.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/AppxManifest.spec.js b/spec/unit/AppxManifest.spec.js
index ab5f992..882b1d3 100644
--- a/spec/unit/AppxManifest.spec.js
+++ b/spec/unit/AppxManifest.spec.js
@@ -54,11 +54,11 @@ describe('AppxManifest', function () {
});
it('Test #001 : should throw if first parameter is not a file', function () {
- expect(function () { new AppxManifest('/invalid/path'); }).toThrow();
+ expect(function () { new AppxManifest('/invalid/path'); }).toThrow(); /* eslint no-new : 0 */
});
it('Test #002 : should throw if first parameter is not a valid manifest file (no "Package" tag)', function () {
- expect(function () { new AppxManifest('/invalid/manifest'); }).toThrow();
+ expect(function () { new AppxManifest('/invalid/manifest'); }).toThrow(); /* eslint no-new : 0 */
});
it('Test #003 : should add ":" to manifest prefix if needed', function () {
@@ -123,7 +123,7 @@ describe('AppxManifest', function () {
});
it('Test #011 : should cache AppxManifest instances by default', function () {
- var manifest = AppxManifest.get('/no/prefixed');
+ var manifest = AppxManifest.get('/no/prefixed');
expect(xml.parseElementtreeSync.calls.count()).toBe(2);
var manifest2 = AppxManifest.get('/no/prefixed');
@@ -133,7 +133,7 @@ describe('AppxManifest', function () {
});
it('Test #012 : should not use cache to get AppxManifest instances when "ignoreCache" is specified', function () {
- var manifest = AppxManifest.get('/no/prefixed');
+ var manifest = AppxManifest.get('/no/prefixed');
expect(xml.parseElementtreeSync.calls.count()).toBe(2);
var manifest2 = AppxManifest.get('/no/prefixed', true);
@@ -143,7 +143,7 @@ describe('AppxManifest', function () {
});
it('Test #013 : should not cache AppxManifest instances when "ignoreCache" is specified', function () {
- var manifest = AppxManifest.get('/no/prefixed', true);
+ var manifest = AppxManifest.get('/no/prefixed', true);
expect(xml.parseElementtreeSync.calls.count()).toBe(2);
var manifest2 = AppxManifest.get('/no/prefixed');
@@ -154,7 +154,7 @@ describe('AppxManifest', function () {
});
describe('instance get* methods', function () {
- var methods = ['getPhoneIdentity','getIdentity','getProperties','getApplication','getVisualElements'];
+ var methods = ['getPhoneIdentity', 'getIdentity', 'getProperties', 'getApplication', 'getVisualElements'];
it('Test #014 : should exists', function () {
var manifest = AppxManifest.get(WINDOWS_PHONE_MANIFEST);
@@ -176,7 +176,7 @@ describe('AppxManifest', function () {
var capabilities = manifest.doc.find('.//Capabilities');
capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
-
+
var xml = manifest.writeToString();
expect((xml.match(/enterpriseAuthentication/g) || []).length).toBe(1);
@@ -234,4 +234,3 @@ describe('AppxManifest', function () {
});
});
});
-
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/ConfigChanges.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/ConfigChanges.spec.js b/spec/unit/ConfigChanges.spec.js
index e641bdc..ef4591a 100644
--- a/spec/unit/ConfigChanges.spec.js
+++ b/spec/unit/ConfigChanges.spec.js
@@ -50,7 +50,7 @@ describe('PlatformMunger', function () {
beforeEach(function () {
shell.mkdir('-p', tempDir);
munge = { parents: { 'foo/bar': [
- { before: undefined, count: 1, xml: '<DummyElement name="Dummy" />'}
+ { before: undefined, count: 1, xml: '<DummyElement name="Dummy" />' }
]}};
munger = new PlatformMunger('windows', tempDir);
spyOn(BaseMunger.prototype, 'apply_file_munge').and.callThrough();
@@ -68,7 +68,7 @@ describe('PlatformMunger', function () {
});
it('should additionally call parent\'s method with another munge if removing changes from windows 10 appxmanifest', function () {
- munger.apply_file_munge(WINDOWS10_MANIFEST, munge, /*remove=*/true);
+ munger.apply_file_munge(WINDOWS10_MANIFEST, munge, /* remove= */true);
expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, munge, true);
});
@@ -76,25 +76,25 @@ describe('PlatformMunger', function () {
// Generate a munge that contain non-prefixed capabilities changes
var baseMunge = { parents: { '/Package/Capabilities': [
// Emulate capability that was initially added with uap prefix
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">'},
- { before: undefined, count: 1, xml: '<Capability Name=\"enterpriseAuthentication\">'}
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' }, /* eslint no-useless-escape : 0 */
+ { before: undefined, count: 1, xml: '<Capability Name=\"enterpriseAuthentication\">' } /* eslint no-useless-escape : 0 */
]}};
var capabilitiesMunge = { parents: { '/Package/Capabilities': [
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">'},
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"enterpriseAuthentication\">'}
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' },
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"enterpriseAuthentication\">' }
]}};
- munger.apply_file_munge(WINDOWS10_MANIFEST, baseMunge, /*remove=*/true);
+ munger.apply_file_munge(WINDOWS10_MANIFEST, baseMunge, /* remove= */true);
expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, capabilitiesMunge, true);
});
});
});
-describe('Capabilities within package.windows.appxmanifest', function() {
+describe('Capabilities within package.windows.appxmanifest', function () {
var testDir, windowsPlatform, windowsManifest, windowsManifest10, dummyPluginInfo, api;
- beforeEach(function() {
+ beforeEach(function () {
testDir = path.join(__dirname, 'testDir');
shell.mkdir('-p', testDir);
shell.cp('-rf', windowsProject + '/*', testDir);
@@ -108,72 +108,72 @@ describe('Capabilities within package.windows.appxmanifest', function() {
api.locations.www = path.join(windowsPlatform, 'www');
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', testDir);
});
- function getPluginCapabilities(pluginInfo) {
+ function getPluginCapabilities (pluginInfo) {
return pluginInfo.getConfigFiles()[0].xmls;
}
- function getManifestCapabilities(manifest) {
+ function getManifestCapabilities (manifest) {
var appxmanifest = AppxManifest.get(manifest, true);
return appxmanifest.getCapabilities();
}
var fail = jasmine.createSpy('fail')
- .and.callFake(function (err) {
- console.error(err);
- });
+ .and.callFake(function (err) {
+ console.error(err);
+ });
- it('should be removed using overriden PlatformMunger', function(done) {
+ it('should be removed using overriden PlatformMunger', function (done) {
api.addPlugin(dummyPluginInfo)
- .then(function() {
- // There is the one default capability in manifest with 'internetClient' name
- expect(getManifestCapabilities(windowsManifest).length).toBe(getPluginCapabilities(dummyPluginInfo).length + 1);
- api.removePlugin(dummyPluginInfo);
- })
- .then(function() {
- expect(getManifestCapabilities(windowsManifest).length).toBe(1);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ // There is the one default capability in manifest with 'internetClient' name
+ expect(getManifestCapabilities(windowsManifest).length).toBe(getPluginCapabilities(dummyPluginInfo).length + 1);
+ api.removePlugin(dummyPluginInfo);
+ })
+ .then(function () {
+ expect(getManifestCapabilities(windowsManifest).length).toBe(1);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
- it('should be added with uap prefixes when install plugin', function(done) {
+ it('should be added with uap prefixes when install plugin', function (done) {
api.addPlugin(dummyPluginInfo)
- .then(function() {
- // There is the one default capability in manifest with 'internetClient' name
- var manifestCapabilities = getManifestCapabilities(windowsManifest10);
- expect(manifestCapabilities.length).toBe(getPluginCapabilities(dummyPluginInfo).length + 1);
-
- // Count 'uap' prefixed capabilities
- var uapPrefixedCapsCount = manifestCapabilities.filter(function(capability) {
- return capability.type === 'uap:Capability';
- }).length;
-
- expect(uapPrefixedCapsCount).toBe(2);
- api.removePlugin(dummyPluginInfo);
- })
- .then(function() {
- expect(getManifestCapabilities(windowsManifest10).length).toBe(1);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ // There is the one default capability in manifest with 'internetClient' name
+ var manifestCapabilities = getManifestCapabilities(windowsManifest10);
+ expect(manifestCapabilities.length).toBe(getPluginCapabilities(dummyPluginInfo).length + 1);
+
+ // Count 'uap' prefixed capabilities
+ var uapPrefixedCapsCount = manifestCapabilities.filter(function (capability) {
+ return capability.type === 'uap:Capability';
+ }).length;
+
+ expect(uapPrefixedCapsCount).toBe(2);
+ api.removePlugin(dummyPluginInfo);
+ })
+ .then(function () {
+ expect(getManifestCapabilities(windowsManifest10).length).toBe(1);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
- it('should be added as DeviceCapabilities when install plugin', function(done) {
- function isDeviceCapability(capability) {
+ it('should be added as DeviceCapabilities when install plugin', function (done) {
+ function isDeviceCapability (capability) {
return capability.type === 'DeviceCapability';
}
- function checkCapabilitiesAfterInstall(manifest) {
+ function checkCapabilitiesAfterInstall (manifest) {
// There is the one default capability in manifest with 'internetClient' name
var manifestCapabilities = getManifestCapabilities(manifest);
var pluginCapabilities = getPluginCapabilities(dummyPluginInfo);
@@ -184,40 +184,40 @@ describe('Capabilities within package.windows.appxmanifest', function() {
expect(manifestDeviceCapabilties.length).toBe(1);
}
- function checkCapabilitiesAfterRemove(manifest) {
+ function checkCapabilitiesAfterRemove (manifest) {
var manifestCapabilities = getManifestCapabilities(manifest);
expect(manifestCapabilities.length).toBe(1);
}
api.addPlugin(dummyPluginInfo)
- .then(function() {
- checkCapabilitiesAfterInstall(windowsManifest);
- checkCapabilitiesAfterInstall(windowsManifest10);
- api.removePlugin(dummyPluginInfo);
- })
- .then(function() {
- checkCapabilitiesAfterRemove(windowsManifest);
- checkCapabilitiesAfterRemove(windowsManifest10);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ checkCapabilitiesAfterInstall(windowsManifest);
+ checkCapabilitiesAfterInstall(windowsManifest10);
+ api.removePlugin(dummyPluginInfo);
+ })
+ .then(function () {
+ checkCapabilitiesAfterRemove(windowsManifest);
+ checkCapabilitiesAfterRemove(windowsManifest10);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
});
-describe('generate_plugin_config_munge for windows project', function() {
- beforeEach(function() {
+describe('generate_plugin_config_munge for windows project', function () {
+ beforeEach(function () {
shell.mkdir('-p', tempDir);
shell.cp('-rf', windows_testapp_jsproj, tempDir);
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', tempDir);
});
- it('should special case config-file elements for windows', function() {
+ it('should special case config-file elements for windows', function () {
var pluginInfoProvider = new PluginInfoProvider();
var munger = new configChanges.PlatformMunger('windows', tempDir, 'unused', null, pluginInfoProvider);
var munge = munger.generate_plugin_config_munge(new PluginInfo(configplugin), {});
@@ -245,7 +245,7 @@ describe('generate_plugin_config_munge for windows project', function() {
expect(windows10AppxManifest.parents['/Parent/Capabilities'].length).toBe(3);
});
- it('should not process change w/o target package.appxmanifest', function() {
+ it('should not process change w/o target package.appxmanifest', function () {
var processChanges = pluginInfo.__get__('processChanges');
var testChanges = [
{
@@ -261,7 +261,7 @@ describe('generate_plugin_config_munge for windows project', function() {
expect(changes[0].target).toBe(testChanges[0].target);
});
- it('should apply changes to all manifests in case of incorrect "deviceTarget" attribute', function() {
+ it('should apply changes to all manifests in case of incorrect "deviceTarget" attribute', function () {
var processChanges = pluginInfo.__get__('processChanges');
var testChanges = [{
@@ -276,4 +276,3 @@ describe('generate_plugin_config_munge for windows project', function() {
expect(changes[2].target).toBe('package.windows10.appxmanifest');
});
});
-
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/JsprojManager.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/JsprojManager.spec.js b/spec/unit/JsprojManager.spec.js
index 132a705..936034e 100644
--- a/spec/unit/JsprojManager.spec.js
+++ b/spec/unit/JsprojManager.spec.js
@@ -30,7 +30,7 @@ var FAKE_MANIFEST = new et.ElementTree(et.XML(
'<?xml version="1.0" encoding="UTF-8"?>' +
'<Package>' +
'<Properties>' +
- '<DisplayName>HelloCordova</DisplayName>'+
+ '<DisplayName>HelloCordova</DisplayName>' +
'</Properties>' +
'</Package>'));
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/MSBuildTools.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/MSBuildTools.spec.js b/spec/unit/MSBuildTools.spec.js
index 8c65248..872c480 100644
--- a/spec/unit/MSBuildTools.spec.js
+++ b/spec/unit/MSBuildTools.spec.js
@@ -28,7 +28,7 @@ var fakeToolsPath = function (version) {
return 'C:\\Program Files (x86)\\MSBuild\\' + version;
};
-describe('findAvailableVersion method', function(){
+describe('findAvailableVersion method', function () {
var checkMSBuildVersionOriginal;
var checkMSBuildVersionFake = function (availableVersions, version) {
@@ -58,38 +58,38 @@ describe('findAvailableVersion method', function(){
buildTools.__set__('checkMSBuildVersion', checkMSBuildVersionOriginal);
});
- it('spec.1 should find 14.0 available version if 12.0 is unavailable', function(done){
+ it('spec.1 should find 14.0 available version if 12.0 is unavailable', function (done) {
versionTest(['14.0'], '14.0', done);
});
- it('spec.2 should select 14.0 available version even if 12.0 is also available', function(done){
+ it('spec.2 should select 14.0 available version even if 12.0 is also available', function (done) {
versionTest(['14.0', '12.0', '4.0'], '14.0', done);
});
- it('spec.3 should find 12.0 available version if 14.0 is unavailable', function(done){
+ it('spec.3 should find 12.0 available version if 14.0 is unavailable', function (done) {
versionTest(['12.0', '4.0'], '12.0', done);
});
- it('spec.4 should find 4.0 available version if neither 12.0 nor 14.0 are available', function(done){
+ it('spec.4 should find 4.0 available version if neither 12.0 nor 14.0 are available', function (done) {
versionTest(['4.0'], '4.0', done);
});
- it('spec.5 should produce an error if there is no available versions', function(done){
+ it('spec.5 should produce an error if there is no available versions', function (done) {
var resolveSpy = jasmine.createSpy();
buildTools.__set__('checkMSBuildVersion', checkMSBuildVersionFake.bind(null, []));
buildTools.findAvailableVersion()
- .then(resolveSpy, function(error){
- expect(error).toBeDefined();
- })
- .finally(function() {
- expect(resolveSpy).not.toHaveBeenCalled();
- done();
- });
+ .then(resolveSpy, function (error) {
+ expect(error).toBeDefined();
+ })
+ .finally(function () {
+ expect(resolveSpy).not.toHaveBeenCalled();
+ done();
+ });
});
});
-describe('checkMSBuildVersion method', function(){
+describe('checkMSBuildVersion method', function () {
var checkMSBuildVersion = buildTools.__get__('checkMSBuildVersion');
var spawnOriginal = buildTools.__get__('spawn');
@@ -103,8 +103,8 @@ describe('checkMSBuildVersion method', function(){
buildTools.__set__('spawn', spawnOriginal);
});
- it('spec.6 should return valid version and path', function(){
- var version = '14.0';
+ it('spec.6 should return valid version and path', function () {
+ var version = '14.0';
spawnSpy.and.returnValue(Q.resolve(
'\r\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\12.0\r\n\t' +
@@ -117,7 +117,7 @@ describe('checkMSBuildVersion method', function(){
});
});
- it('spec.7 should return null if no tools found for version', function(){
+ it('spec.7 should return null if no tools found for version', function () {
spawnSpy.and.returnValue(Q.resolve('ERROR: The system was unable to find the specified registry key or value.'));
checkMSBuildVersion('14.0').then(function (actual) {
@@ -125,7 +125,7 @@ describe('checkMSBuildVersion method', function(){
});
});
- it('spec.8 should return null on internal error', function(){
+ it('spec.8 should return null on internal error', function () {
spawnSpy.and.returnValue(Q.reject());
checkMSBuildVersion('14.0').then(function (actual) {
@@ -134,11 +134,11 @@ describe('checkMSBuildVersion method', function(){
});
});
-describe('MSBuildTools object', function(){
- it('spec.9 should have fields and methods defined', function() {
- var version = '14.0',
- toolsPath = fakeToolsPath(version),
- actual = new MSBuildTools(version, toolsPath);
+describe('MSBuildTools object', function () {
+ it('spec.9 should have fields and methods defined', function () {
+ var version = '14.0';
+ var toolsPath = fakeToolsPath(version);
+ var actual = new MSBuildTools(version, toolsPath);
expect(actual.path).toBeDefined();
expect(actual.path).toBe(toolsPath);
@@ -148,8 +148,8 @@ describe('MSBuildTools object', function(){
});
});
-describe('getAvailableUAPVersions method', function(){
- /*jshint -W069 */
+describe('getAvailableUAPVersions method', function () {
+ /* jshint -W069 */
var availableVersions = ['10.0.10030.0', '10.0.10166.0', '10.0.10078.0'];
var shellTest, shellLs;
var programFilesx86Orig = process.env['ProgramFiles(x86)'];
@@ -167,26 +167,26 @@ describe('getAvailableUAPVersions method', function(){
process.env['ProgramFiles'] = programFilesOrig;
});
- it('should return list of available versions', function() {
+ it('should return list of available versions', function () {
var versions = buildTools.getAvailableUAPVersions();
expect(versions).toEqual(jasmine.any(Array));
expect(versions.length).toEqual(3);
});
- it('should return empty array if no UAP SDKs installed', function() {
+ it('should return empty array if no UAP SDKs installed', function () {
shellLs.and.returnValue([]);
expect(buildTools.getAvailableUAPVersions().length).toEqual(0);
shellTest.and.returnValue(false);
expect(buildTools.getAvailableUAPVersions().length).toEqual(0);
});
- it('should return empty array if it isn\'t able to detect SDK location', function() {
+ it('should return empty array if it isn\'t able to detect SDK location', function () {
delete process.env['ProgramFiles(x86)'];
delete process.env['ProgramFiles'];
expect(buildTools.getAvailableUAPVersions().length).toEqual(0);
});
- it('should return sorted list versions with only valid versions', function() {
+ it('should return sorted list versions with only valid versions', function () {
var brokenAvailableVersions = availableVersions.concat('Broken.version');
shellLs.and.returnValue(brokenAvailableVersions);
@@ -225,25 +225,25 @@ describe('getMSBuildToolsAt method', function () {
spawnSpy.and.returnValue(Q(fakeVersion));
buildTools.getMSBuildToolsAt(fakePath)
- .then(function (tools) {
- expect(tools).toEqual(jasmine.any(MSBuildTools));
- expect(tools.version).toBe(fakeVersionParsed);
- expect(tools.path).toBe(fakePath);
- }, fail)
- .done(function () {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function (tools) {
+ expect(tools).toEqual(jasmine.any(MSBuildTools));
+ expect(tools.version).toBe(fakeVersionParsed);
+ expect(tools.path).toBe(fakePath);
+ }, fail)
+ .done(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
it('should reject promise if no msbuild found', function (done) {
spawnSpy.and.returnValue(Q.reject());
buildTools.getMSBuildToolsAt(messyPath)
- .then(success, fail)
- .done(function () {
- expect(success).not.toHaveBeenCalled();
- done();
- });
+ .then(success, fail)
+ .done(function () {
+ expect(success).not.toHaveBeenCalled();
+ done();
+ });
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org