You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/02/22 00:07:39 UTC

[08/32] cordova-lib git commit: CB-12021 : updated jshint and added includes method to support node 0.x

CB-12021 : updated jshint and added includes method to support node 0.x


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/4d095776
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/4d095776
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/4d095776

Branch: refs/heads/master
Commit: 4d095776ce058dc52f74ef56912ff3cae6b28a49
Parents: a5b0441
Author: Audrey So <au...@apache.org>
Authored: Thu Feb 16 15:40:53 2017 -0800
Committer: Audrey So <au...@apache.org>
Committed: Thu Feb 16 15:40:53 2017 -0800

----------------------------------------------------------------------
 cordova-lib/package.json                 |  2 +-
 cordova-lib/spec-cordova/pkgJson.spec.js | 20 ++++++++++++++++----
 cordova-lib/src/cordova/platform.js      |  6 +++---
 3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4d095776/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index a05d0a4..d0195ca 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -55,7 +55,7 @@
     "test": "npm run jshint && npm run jasmine",
     "test-ios": "npm run test && npm run jasmine-ios",
     "ci": "npm run jshint && npm run cover && codecov",
-    "jshint": "jshint src spec-cordova spec-plugman",
+    "jshint": "./node_modules/.bin/jshint src spec-cordova spec-plugman",
     "jasmine": "jasmine --captureExceptions --color",
     "jasmine-ios": "jasmine --captureExceptions --color spec-cordova/platform.spec.ios.js --matchall",
     "cover": "istanbul cover --root src --print detail jasmine"

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4d095776/cordova-lib/spec-cordova/pkgJson.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/pkgJson.spec.js b/cordova-lib/spec-cordova/pkgJson.spec.js
index f003a26..362c216 100644
--- a/cordova-lib/spec-cordova/pkgJson.spec.js
+++ b/cordova-lib/spec-cordova/pkgJson.spec.js
@@ -25,6 +25,14 @@ var helpers = require('./helpers'),
     TIMEOUT = 30 * 1000,
     semver  = require('semver');
 
+function includeFunc(container, value) {
+   var returnValue = false;
+   var pos = container.indexOf(value);
+   if (pos >= 0) {
+       returnValue = true;
+   }
+   return returnValue;
+}
 // This group of tests checks if plugins are added and removed as expected from package.json.
 describe('plugin end-to-end', function() {
     var pluginId = 'cordova-plugin-device';
@@ -335,7 +343,8 @@ describe('plugin end-to-end', function() {
             });
             engSpec = engines.map(function(elem) {  
                 if (elem.name === 'browser') {
-                    expect(elem.spec.includes(platformPath)).toEqual(true);
+                    var result = includeFunc(elem.spec , platformPath);
+                    expect(result).toEqual(true);
                 }
             });
         }).then(function() {
@@ -359,7 +368,8 @@ describe('plugin end-to-end', function() {
             });
             engSpec = engines.map(function(elem) {  
                 if (elem.name === 'browser') {
-                    expect(elem.spec.includes(platformPath)).toEqual(true);
+                    var result = includeFunc(elem.spec , platformPath);
+                    expect(result).toEqual(true);
                 }
             });
         }).fail(function(err) {
@@ -966,7 +976,8 @@ describe('local path is added to config.xml without pkg.json', function () {
             });
             engSpec = engines.map(function(elem) {  
                 if (elem.name === 'browser') {
-                    expect(elem.spec.includes(platformPath)).toEqual(true);
+                    var result = includeFunc(elem.spec , platformPath);
+                    expect(result).toEqual(true);
                 }
             });
         }).fail(function(err) {
@@ -992,7 +1003,8 @@ describe('local path is added to config.xml without pkg.json', function () {
             // Plugin is added.
             expect(configPlugin.name).toEqual('cordova-lib-test-plugin');
             // Spec for geolocation plugin is added.
-            expect(configPlugin.spec.includes(pluginPath)).toEqual(true);
+            var result = includeFunc(configPlugin.spec , pluginPath);
+            expect(result).toEqual(true);
         }).fail(function(err) {
             expect(err).toBeUndefined();
         }).fin(done);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4d095776/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 437db3d..f77b945 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -229,7 +229,7 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                 })
                 .then(function () {
                     if (!opts.restoring) {
-                        // Call prepare for the current platform if we're not restoring from config.xml
+                        // Call prepare for the current platform if we're not restoring from config.xml.
                         var prepOpts = {
                             platforms :[platform],
                             searchpath :opts.searchpath,
@@ -256,14 +256,14 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
 
                         spec = saveVersion ? '~' + platDetails.version : spec;
 
-                        // Save target into config.xml, overriding already existing settings
+                        // Save target into config.xml, overriding already existing settings.
                         events.emit('log', '--save flag or autosave detected');
                         events.emit('log', 'Saving ' + platform + '@' + spec + ' into config.xml file ...');
                         cfg.removeEngine(platform);
                         cfg.addEngine(platform, spec);
                         cfg.write();
                         
-                        //save to add to pacakge.json's cordova.platforms array in the next then
+                        // Save to add to pacakge.json's cordova.platforms array in the next then.
                         platformsToSave.push(platform);
                     }
                 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org