You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2015/02/02 17:50:23 UTC
[2/4] cordova-lib git commit: CB-6973 fix spec-plugman jshint failures
CB-6973 fix spec-plugman jshint failures
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/35391350
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/35391350
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/35391350
Branch: refs/heads/master
Commit: 35391350bcdf747ece4c2a3aca1b83826c0ceb99
Parents: 3d4c4c4
Author: Murat Sutunc <su...@gmail.com>
Authored: Sun Feb 1 23:59:12 2015 -0800
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Mon Feb 2 11:48:00 2015 -0500
----------------------------------------------------------------------
cordova-lib/.jshintignore | 2 +
cordova-lib/spec-plugman/add_platform.spec.js | 16 ++--
cordova-lib/spec-plugman/common.js | 2 +-
cordova-lib/spec-plugman/fetch.spec.js | 26 +++---
.../spec-plugman/install-browserify.spec.js | 35 ++++----
cordova-lib/spec-plugman/install.spec.js | 30 +++----
cordova-lib/spec-plugman/platform.spec.js | 8 +-
.../platforms/amazon-fireos.spec.js | 2 +
.../spec-plugman/platforms/android.spec.js | 87 ++++++++++----------
.../spec-plugman/platforms/blackberry10.spec.js | 10 +--
.../spec-plugman/platforms/common.spec.js | 21 +++--
cordova-lib/spec-plugman/platforms/ios.spec.js | 48 +++++------
.../spec-plugman/platforms/tizen.spec.js | 15 ++--
.../spec-plugman/platforms/windows8.spec.js | 5 +-
cordova-lib/spec-plugman/platforms/wp8.spec.js | 10 +--
cordova-lib/spec-plugman/prepare.spec.js | 9 +-
.../spec-plugman/registry/registry.spec.js | 4 +-
.../spec-plugman/uninstall-browserify.spec.js | 31 +++----
cordova-lib/spec-plugman/uninstall.spec.js | 29 +++----
.../spec-plugman/util/action-stack.spec.js | 3 +-
.../spec-plugman/util/config-changes.spec.js | 10 +--
cordova-lib/spec-plugman/util/csproj.spec.js | 13 +--
.../spec-plugman/util/dependencies.spec.js | 20 ++---
cordova-lib/spec-plugman/util/plugins.spec.js | 6 +-
.../spec-plugman/util/xml-helpers.spec.js | 34 ++++----
cordova-lib/spec-plugman/wrappers.spec.js | 5 +-
26 files changed, 227 insertions(+), 254 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/.jshintignore
----------------------------------------------------------------------
diff --git a/cordova-lib/.jshintignore b/cordova-lib/.jshintignore
index 093d88e..e13e685 100644
--- a/cordova-lib/.jshintignore
+++ b/cordova-lib/.jshintignore
@@ -2,3 +2,5 @@ spec-cordova/fixtures/platforms/android/*
spec-cordova/fixtures/base/www/index.html
spec-cordova/fixtures/base/www/js/index.js
spec-cordova/fixtures/projWithHooks/www/js/index.js
+spec-plugman/projects/*
+spec-plugman/plugins/*
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/add_platform.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/add_platform.spec.js b/cordova-lib/spec-plugman/add_platform.spec.js
index d499b69..208216b 100644
--- a/cordova-lib/spec-plugman/add_platform.spec.js
+++ b/cordova-lib/spec-plugman/add_platform.spec.js
@@ -18,9 +18,7 @@
*/
var platform = require('../src/plugman/platform'),
Q = require('q'),
- fs = require('fs'),
- shell = require('shelljs'),
- plugman = require('../src/plugman/plugman');
+ fs = require('fs');
describe( 'platform add/remove', function() {
it( 'should call platform add', function() {
@@ -36,9 +34,7 @@ describe( 'platform add/remove', function() {
describe( 'platform add', function() {
var done = false,
- existsSync,
- mkdir,
- writeFileSync;
+ existsSync;
function platformPromise( f ) {
f.then( function() { done = true; }, function(err) { done = err; } );
}
@@ -52,7 +48,7 @@ describe( 'platform add', function() {
});
waitsFor(function() { return done; }, 'platform promise never resolved', 500);
runs(function() {
- expect(''+ done ).toContain( "can't find a plugin.xml. Are you in the plugin?" );
+ expect(''+ done ).toContain( 'can\'t find a plugin.xml. Are you in the plugin?' );
});
});
});
@@ -60,9 +56,7 @@ describe( 'platform add', function() {
describe( 'platform remove', function() {
var done = false,
- existsSync,
- mkdir,
- writeFileSync;
+ existsSync;
function platformPromise( f ) {
f.then( function() { done = true; }, function(err) { done = err; } );
}
@@ -76,7 +70,7 @@ describe( 'platform remove', function() {
});
waitsFor(function() { return done; }, 'platform promise never resolved', 500);
runs(function() {
- expect(''+ done ).toContain( "can't find a plugin.xml. Are you in the plugin?" );
+ expect(''+ done ).toContain( 'can\'t find a plugin.xml. Are you in the plugin?' );
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/common.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/common.js b/cordova-lib/spec-plugman/common.js
index 731e6fb..d1d0db0 100644
--- a/cordova-lib/spec-plugman/common.js
+++ b/cordova-lib/spec-plugman/common.js
@@ -17,7 +17,6 @@
under the License.
*/
-var plugman = require('../src/plugman/plugman')
// nopt = require('nopt');
// var known_opts = {
@@ -46,6 +45,7 @@ var plugman = require('../src/plugman/plugman')
// if(opt.debug >= 6)
// plugman.on('log', console.log);
// }
+var common = {};
module.exports = common = {
spy: {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/fetch.spec.js b/cordova-lib/spec-plugman/fetch.spec.js
index b2785e2..6b44195 100644
--- a/cordova-lib/spec-plugman/fetch.spec.js
+++ b/cordova-lib/spec-plugman/fetch.spec.js
@@ -30,8 +30,6 @@ var fetch = require('../src/plugman/fetch'),
test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
test_plugin_id = 'org.test.plugins.childbrowser',
test_plugin_version ='0.6.0',
- somedir = test_plugin,
- somedir = path.join(temp, test_plugin_id),
plugins = require('../src/plugman/util/plugins'),
Q = require('q'),
registry = require('../src/plugman/registry/registry');
@@ -59,7 +57,7 @@ describe('fetch', function() {
});
describe('local plugins', function() {
- var xml, rm, sym, mkdir, cp, save_metadata;
+ var rm, sym, cp, save_metadata;
beforeEach(function() {
rm = spyOn(shell, 'rm');
sym = spyOn(fs, 'symlinkSync');
@@ -107,7 +105,7 @@ describe('fetch', function() {
});
});
describe('git plugins', function() {
- var clone, save_metadata, done, xml;
+ var clone, save_metadata, done;
function fetchPromise(f) {
f.then(function() { done = true; }, function(err) { done = err; });
@@ -119,7 +117,7 @@ describe('fetch', function() {
done = false;
});
it('should call clonePluginGitRepo for https:// and git:// based urls', function() {
- var url = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git';
runs(function() {
fetchPromise(fetch(url, temp));
});
@@ -131,7 +129,7 @@ describe('fetch', function() {
});
});
it('should call clonePluginGitRepo with subdir if applicable', function() {
- var url = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git';
var dir = 'fakeSubDir';
runs(function() {
fetchPromise(fetch(url, temp, { subdir: dir }));
@@ -143,7 +141,7 @@ describe('fetch', function() {
});
});
it('should call clonePluginGitRepo with subdir and git ref if applicable', function() {
- var url = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git';
var dir = 'fakeSubDir';
var ref = 'fakeGitRef';
runs(function() {
@@ -156,8 +154,8 @@ describe('fetch', function() {
});
});
it('should extract the git ref from the URL hash, if provided', function() {
- var url = "https://github.com/bobeast/GAPlugin.git#fakeGitRef";
- var baseURL = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef';
+ var baseURL = 'https://github.com/bobeast/GAPlugin.git';
runs(function() {
fetchPromise(fetch(url, temp, {}));
});
@@ -168,8 +166,8 @@ describe('fetch', function() {
});
});
it('should extract the subdir from the URL hash, if provided', function() {
- var url = "https://github.com/bobeast/GAPlugin.git#:fakeSubDir";
- var baseURL = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git#:fakeSubDir';
+ var baseURL = 'https://github.com/bobeast/GAPlugin.git';
runs(function() {
fetchPromise(fetch(url, temp, {}));
});
@@ -180,8 +178,8 @@ describe('fetch', function() {
});
});
it('should extract the git ref and subdir from the URL hash, if provided', function() {
- var url = "https://github.com/bobeast/GAPlugin.git#fakeGitRef:/fake/Sub/Dir/";
- var baseURL = "https://github.com/bobeast/GAPlugin.git";
+ var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef:/fake/Sub/Dir/';
+ var baseURL = 'https://github.com/bobeast/GAPlugin.git';
runs(function() {
fetchPromise(fetch(url, temp, {}));
});
@@ -215,7 +213,7 @@ describe('fetch', function() {
});
describe('registry plugins', function() {
var pluginId = 'dummyplugin', sFetch;
- var xml, rm, sym, mkdir, cp, save_metadata;
+ var rm, sym, save_metadata;
beforeEach(function() {
rm = spyOn(shell, 'rm');
sym = spyOn(fs, 'symlinkSync');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/install-browserify.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install-browserify.spec.js b/cordova-lib/spec-plugman/install-browserify.spec.js
index 6127e69..963a8b2 100644
--- a/cordova-lib/spec-plugman/install-browserify.spec.js
+++ b/cordova-lib/spec-plugman/install-browserify.spec.js
@@ -16,13 +16,14 @@
// specific language governing permissions and limitations
// under the License.
// */
+
+/* jshint sub:true */
+
var install = require('../src/plugman/install'),
actions = require('../src/plugman/util/action-stack'),
PlatformJson = require('../src/plugman/util/PlatformJson'),
- xml_helpers = require('../src/util/xml-helpers'),
events = require('../src/events'),
plugman = require('../src/plugman/plugman'),
- browserify = require('../src/plugman/prepare-browserify'),
platforms = require('../src/plugman/platforms/common'),
common = require('./common'),
fs = require('fs'),
@@ -86,10 +87,10 @@ var fake = {
return Q( path.join(plugins_dir, 'dependencies', id) );
}
}
-}
+};
describe('start', function() {
- var prepare, prepareBrowserify, config_queue_add, proc, actions_push, ca, emit, write;
+ var prepare, prepareBrowserify, config_queue_add, proc, actions_push, ca, emit;
beforeEach(function() {
prepare = spyOn(plugman, 'prepare');
@@ -106,7 +107,7 @@ describe('start', function() {
done = false;
promise = Q()
.then(
- function(){ return install('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true }) }
+ function(){ return install('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true }); }
).then(
function(){
results['actions_callCount'] = actions_push.callCount;
@@ -117,15 +118,15 @@ describe('start', function() {
}
).then(
function(){
- return install('android', project, plugins['com.cordova.engine'], plugins_install_dir, { browserify: true }) }
+ return install('android', project, plugins['com.cordova.engine'], plugins_install_dir, { browserify: true }); }
).then(
function(){
emit = spyOn(events, 'emit');
- return install('android', project, plugins['org.test.plugins.childbrowser'], plugins_install_dir, { browserify: true })
+ return install('android', project, plugins['org.test.plugins.childbrowser'], plugins_install_dir, { browserify: true });
}
).then(
function(){
- return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { browserify: true, cli_variables:{API_KEY:'batman'} })
+ return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { browserify: true, cli_variables:{API_KEY:'batman'} });
}
).then(
function(){
@@ -138,7 +139,7 @@ describe('start', function() {
results['emit_results'].push(emit.calls[i].args[1]);
}
- events.emit("verbose", "***** DONE START *****");
+ events.emit('verbose', '***** DONE START *****');
}
).fail(
function(error) {
@@ -150,12 +151,12 @@ describe('start', function() {
});
describe('install', function() {
- var chmod, exec, proc, add_to_queue, prepare, actions_push, c_a, mkdir, cp, rm, fetchSpy, emit;
+ var chmod, exec, add_to_queue, prepare, cp, rm, fetchSpy;
var spawnSpy;
beforeEach(function() {
prepare = spyOn(plugman, 'prepare').andReturn( Q(true) );
- prepareBrowserify = spyOn(plugman, 'prepareBrowserify');
+ spyOn(plugman, 'prepareBrowserify');
exec = spyOn(child_process, 'exec').andCallFake(function(cmd, cb) {
cb(false, '', '');
});
@@ -166,7 +167,7 @@ describe('install', function() {
fetchSpy = spyOn(plugman.raw, 'fetch').andReturn( Q( plugins['com.cordova.engine'] ) );
chmod = spyOn(fs, 'chmodSync').andReturn(true);
- fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
+ spyOn(fs, 'writeFileSync').andReturn(true);
cp = spyOn(shell, 'cp').andReturn(true);
rm = spyOn(shell, 'rm').andReturn(true);
add_to_queue = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
@@ -355,7 +356,7 @@ describe('install', function() {
'Install start for "C" on android.',
'Install start for "D" on android.',
'Install start for "A" on android.'
- ]);;
+ ]);
});
});
@@ -384,7 +385,7 @@ describe('install', function() {
});
waitsFor(function () { return done; }, 'install promise never resolved', 200);
runs(function () {
- var install = common.spy.getInstall(emit);
+ common.spy.getInstall(emit);
expect(done.message).toEqual('Cyclic dependency from G to H');
});
@@ -428,7 +429,7 @@ describe('install', function() {
'Install start for "B" on android.'
]);
- var copy = common.spy.startsWith(emit, "Copying from");
+ var copy = common.spy.startsWith(emit, 'Copying from');
expect(copy.length).toBe(3);
expect(copy[0].indexOf(path.normalize('meta/D')) > 0).toBe(true);
expect(copy[1].indexOf(path.normalize('meta/subdir/E')) > 0).toBe(true);
@@ -460,7 +461,7 @@ describe('install', function() {
it('should throw if git is not found on the path and a remote url is requested', function() {
spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
fetchSpy.andCallThrough();
- var which_spy = spyOn(shell, 'which').andReturn(null);
+ spyOn(shell, 'which').andReturn(null);
runs(function() {
installPromise( install('android', project, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git', plugins_install_dir, { browserify: true }) );
});
@@ -470,7 +471,7 @@ describe('install', function() {
});
});
it('should throw if plugin version is less than the minimum requirement', function(){
- var spy = spyOn(semver, 'satisfies').andReturn(false);
+ spyOn(semver, 'satisfies').andReturn(false);
exec.andCallFake(function(cmd, cb) {
cb(null, '0.0.1\n');
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js b/cordova-lib/spec-plugman/install.spec.js
index abece9c..69c2aba 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -16,10 +16,12 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint sub:true */
+
var install = require('../src/plugman/install'),
actions = require('../src/plugman/util/action-stack'),
PlatformJson = require('../src/plugman/util/PlatformJson'),
- xml_helpers = require('../src/util/xml-helpers'),
events = require('../src/events'),
plugman = require('../src/plugman/plugman'),
platforms = require('../src/plugman/platforms/common'),
@@ -85,7 +87,7 @@ var fake = {
return Q( path.join(plugins_dir, 'dependencies', id) );
}
}
-}
+};
describe('start', function() {
var prepare, config_queue_add, proc, actions_push, ca, emit;
@@ -104,7 +106,7 @@ describe('start', function() {
done = false;
promise = Q()
.then(
- function(){ return install('android', project, plugins['org.test.plugins.dummyplugin']) }
+ function(){ return install('android', project, plugins['org.test.plugins.dummyplugin']); }
).then(
function(){
results['actions_callCount'] = actions_push.callCount;
@@ -114,15 +116,15 @@ describe('start', function() {
return Q();
}
).then(
- function(){ return install('android', project, plugins['com.cordova.engine']) }
+ function(){ return install('android', project, plugins['com.cordova.engine']); }
).then(
function(){
emit = spyOn(events, 'emit');
- return install('android', project, plugins['org.test.plugins.childbrowser'])
+ return install('android', project, plugins['org.test.plugins.childbrowser']);
}
).then(
function(){
- return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} })
+ return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} });
}
).then(
function(){
@@ -135,7 +137,7 @@ describe('start', function() {
results['emit_results'].push(emit.calls[i].args[1]);
}
- events.emit("verbose", "***** DONE START *****");
+ events.emit('verbose', '***** DONE START *****');
}
).fail(
function(error) {
@@ -147,7 +149,7 @@ describe('start', function() {
});
describe('install', function() {
- var chmod, exec, proc, add_to_queue, prepare, actions_push, c_a, mkdir, cp, rm, fetchSpy, emit;
+ var chmod, exec, add_to_queue, prepare, cp, rm, fetchSpy;
var spawnSpy;
beforeEach(function() {
@@ -163,7 +165,7 @@ describe('install', function() {
fetchSpy = spyOn(plugman.raw, 'fetch').andReturn( Q( plugins['com.cordova.engine'] ) );
chmod = spyOn(fs, 'chmodSync').andReturn(true);
- fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
+ spyOn(fs, 'writeFileSync').andReturn(true);
cp = spyOn(shell, 'cp').andReturn(true);
rm = spyOn(shell, 'rm').andReturn(true);
add_to_queue = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
@@ -352,7 +354,7 @@ describe('install', function() {
'Install start for "C" on android.',
'Install start for "D" on android.',
'Install start for "A" on android.'
- ]);;
+ ]);
});
});
@@ -381,7 +383,7 @@ describe('install', function() {
});
waitsFor(function () { return done; }, 'install promise never resolved', 200);
runs(function () {
- var install = common.spy.getInstall(emit);
+ common.spy.getInstall(emit);
expect(done.message).toEqual('Cyclic dependency from G to H');
});
@@ -425,7 +427,7 @@ describe('install', function() {
'Install start for "B" on android.'
]);
- var copy = common.spy.startsWith(emit, "Copying from");
+ var copy = common.spy.startsWith(emit, 'Copying from');
expect(copy.length).toBe(3);
expect(copy[0].indexOf(path.normalize('meta/D')) > 0).toBe(true);
expect(copy[1].indexOf(path.normalize('meta/subdir/E')) > 0).toBe(true);
@@ -457,7 +459,7 @@ describe('install', function() {
it('should throw if git is not found on the path and a remote url is requested', function() {
spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
fetchSpy.andCallThrough();
- var which_spy = spyOn(shell, 'which').andReturn(null);
+ spyOn(shell, 'which').andReturn(null);
runs(function() {
installPromise( install('android', project, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git') );
});
@@ -467,7 +469,7 @@ describe('install', function() {
});
});
it('should throw if plugin version is less than the minimum requirement', function(){
- var spy = spyOn(semver, 'satisfies').andReturn(false);
+ spyOn(semver, 'satisfies').andReturn(false);
exec.andCallFake(function(cmd, cb) {
cb(null, '0.0.1\n');
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platform.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platform.spec.js b/cordova-lib/spec-plugman/platform.spec.js
index 2608cfc..356e833 100644
--- a/cordova-lib/spec-plugman/platform.spec.js
+++ b/cordova-lib/spec-plugman/platform.spec.js
@@ -16,8 +16,8 @@
specific language governing permissions and limitations
under the License.
*/
-var platforms = require('../src/plugman/platforms')
-var pluginTags = ["source-file", "header-file", "lib-file", "resource-file", "framework"];
+var platforms = require('../src/plugman/platforms');
+var pluginTags = ['source-file', 'header-file', 'lib-file', 'resource-file', 'framework'];
function getTest(platformId, pluginTag) {
return function() {
@@ -30,13 +30,13 @@ function getTest(platformId, pluginTag) {
it('with an uninstall method', function() {
expect(platforms[platformId][pluginTag].uninstall ).toBeDefined();
});
- }
+ };
}
for(var platformId in platforms) {
for(var index = 0, len = pluginTags.length; index < len; index++) {
var funk = getTest(platformId,pluginTags[index]);
- describe(platformId + " should have a " + pluginTags[index] + " object", funk);
+ describe(platformId + ' should have a ' + pluginTags[index] + ' object', funk);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js b/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
index 917c484..3e6fa2d 100644
--- a/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
+++ b/cordova-lib/spec-plugman/platforms/amazon-fireos.spec.js
@@ -16,6 +16,7 @@
specific language governing permissions and limitations
under the License.
*/
+/*
var amazon_fireos = require('../../src/plugman/platforms/amazon-fireos'),
common = require('../../src/plugman/platforms/common'),
install = require('../../src/plugman/install'),
@@ -45,6 +46,7 @@ var invalid_source = faultyPluginInfo.getSourceFiles('amazon-fireos');
function copyArray(arr) {
return Array.prototype.slice.call(arr, 0);
}
+*/
/*
describe('amazon-fireos project handler', function() {
describe('www_dir method', function() {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js
index f512b1a..c6bbd7d 100644
--- a/cordova-lib/spec-plugman/platforms/android.spec.js
+++ b/cordova-lib/spec-plugman/platforms/android.spec.js
@@ -16,6 +16,9 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint sub:true */
+
var android = require('../../src/plugman/platforms/android'),
android_project = require('../../src/plugman/util/android-project'),
common = require('../../src/plugman/platforms/common'),
@@ -23,13 +26,10 @@ var android = require('../../src/plugman/platforms/android'),
path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
- et = require('elementtree'),
os = require('osenv'),
_ = require('underscore'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/util/xml-helpers'),
- plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin'),
android_one_project = path.join(__dirname, '..', 'projects', 'android_one', '*'),
@@ -41,8 +41,7 @@ var dummyPluginInfo = new PluginInfo(dummyplugin);
var dummy_id = dummyPluginInfo.id;
var valid_source = dummyPluginInfo.getSourceFiles('android'),
valid_resources = dummyPluginInfo.getResourceFiles('android'),
- valid_libs = dummyPluginInfo.getLibFiles('android'),
- dummy_configs = dummyPluginInfo.getConfigFiles('android');
+ valid_libs = dummyPluginInfo.getLibFiles('android');
var faultyPluginInfo = new PluginInfo(faultyplugin);
var invalid_source = faultyPluginInfo.getSourceFiles('android');
@@ -71,7 +70,7 @@ describe('android project handler', function() {
shell.rm('-rf', temp);
});
describe('of <lib-file> elements', function() {
- it("should copy jar files to project/libs", function () {
+ it('should copy jar files to project/libs', function () {
var s = spyOn(common, 'copyFile');
android['lib-file'].install(valid_libs[0], dummyplugin, temp);
@@ -79,7 +78,7 @@ describe('android project handler', function() {
});
});
describe('of <resource-file> elements', function() {
- it("should copy files", function () {
+ it('should copy files', function () {
var s = spyOn(common, 'copyFile');
android['resource-file'].install(valid_resources[0], dummyplugin, temp);
@@ -121,18 +120,18 @@ describe('android project handler', function() {
android.purgeProjectFileCache(temp);
});
it('with custom=true should update the main and library projects', function() {
- var packageIdSuffix = "PlugmanTest";
- var packageId = "io.cordova." + packageIdSuffix;
- var frameworkElement = { src: "LibraryPath", custom: true };
+ var packageIdSuffix = 'PlugmanTest';
+ var packageId = 'io.cordova.' + packageIdSuffix;
+ var frameworkElement = { src: 'LibraryPath', custom: true };
var subDir = path.resolve(temp, dummy_id, packageIdSuffix + '-' + frameworkElement.src);
- var mainProjectPropsFile = path.resolve(temp, "project.properties");
- var mainProjectManifestFile = path.resolve(temp, "AndroidManifest.xml");
- var subProjectPropsFile = path.resolve(subDir, "project.properties");
+ var mainProjectPropsFile = path.resolve(temp, 'project.properties');
+ var mainProjectManifestFile = path.resolve(temp, 'AndroidManifest.xml');
+ var subProjectPropsFile = path.resolve(subDir, 'project.properties');
- var existsSync = spyOn( fs, 'existsSync').andReturn(true);
+ spyOn( fs, 'existsSync').andReturn(true);
var writeFileSync = spyOn(fs, 'writeFileSync');
- var copyNewFile = spyOn(common, 'copyNewFile');
- var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) {
+ spyOn(common, 'copyNewFile');
+ spyOn(fs, 'readFileSync').andCallFake(function (file) {
file = path.normalize(file);
if (file === mainProjectPropsFile) {
return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2=ExistingLibRef2';
@@ -141,10 +140,10 @@ describe('android project handler', function() {
} else if (file === mainProjectManifestFile) {
return '<manifest package="' + packageId + '">';
} else {
- throw new Error("Trying to read from an unexpected file " + file + '\n expected: ' + mainProjectPropsFile + '\n' + subProjectPropsFile);
+ throw new Error('Trying to read from an unexpected file ' + file + '\n expected: ' + mainProjectPropsFile + '\n' + subProjectPropsFile);
}
- })
- var exec = spyOn(shell, 'exec');
+ });
+ spyOn(shell, 'exec');
android['framework'].install(frameworkElement, dummyplugin, temp, dummy_id);
android.parseProjectFile(temp).write();
@@ -155,30 +154,30 @@ describe('android project handler', function() {
expect(_.any(writeFileSync.argsForCall, function (callArgs) {
return callArgs[0] === subProjectPropsFile && callArgs[1].indexOf('\ntarget=android-19') > -1;
})).toBe(true, 'target SDK version not copied to library');
- expect(exec).toHaveBeenCalledWith('android update lib-project --path "' + subDir + '"');
+ expect(shell.exec).toHaveBeenCalledWith('android update lib-project --path "' + subDir + '"');
});
it('with custom=false should update the main and library projects', function() {
- var frameworkElement = { src: "extras/android/support/v7/appcompat" };
- var subDir = path.resolve("~/android-sdk", frameworkElement.src);
- var localPropsFile = path.resolve(temp, "local.properties");
- var mainProjectPropsFile = path.resolve(temp, "project.properties");
- var subProjectPropsFile = path.resolve(subDir, "project.properties");
+ var frameworkElement = { src: 'extras/android/support/v7/appcompat' };
+ var subDir = path.resolve('~/android-sdk', frameworkElement.src);
+ var localPropsFile = path.resolve(temp, 'local.properties');
+ var mainProjectPropsFile = path.resolve(temp, 'project.properties');
+ var subProjectPropsFile = path.resolve(subDir, 'project.properties');
- var existsSync = spyOn( fs, 'existsSync').andReturn(true);
+ spyOn( fs, 'existsSync').andReturn(true);
var writeFileSync = spyOn(fs, 'writeFileSync');
- var copyNewFile = spyOn(common, 'copyNewFile');
- var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) {
+ spyOn(common, 'copyNewFile');
+ spyOn(fs, 'readFileSync').andCallFake(function (file) {
if (path.normalize(file) === mainProjectPropsFile) {
return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2=ExistingLibRef2';
} else if (path.normalize(file) === subProjectPropsFile) {
return '#Some comment\ntarget=android-17\nandroid.library=true';
} else if (path.normalize(file) === localPropsFile) {
- return "sdk.dir=~/android-sdk";
+ return 'sdk.dir=~/android-sdk';
} else {
- throw new Error("Trying to read from an unexpected file " + file);
+ throw new Error('Trying to read from an unexpected file ' + file);
}
- })
- var exec = spyOn(shell, 'exec');
+ });
+ spyOn(shell, 'exec');
android['framework'].install(frameworkElement, dummyplugin, temp, dummy_id);
android.parseProjectFile(temp).write();
@@ -190,7 +189,7 @@ describe('android project handler', function() {
expect(_.any(writeFileSync.argsForCall, function (callArgs) {
return callArgs[0] === subProjectPropsFile && callArgs[1].indexOf('\ntarget=android-19') > -1;
})).toBe(true, 'target SDK version not copied to library');
- expect(exec).toHaveBeenCalledWith('android update lib-project --path "' + subDir + '"');
+ expect(shell.exec).toHaveBeenCalledWith('android update lib-project --path "' + subDir + '"');
});
});
});
@@ -237,25 +236,25 @@ describe('android project handler', function() {
android.purgeProjectFileCache(temp);
});
it('should remove library reference from the main project', function () {
- var packageIdSuffix = "PlugmanTest";
- var packageId = "io.cordova." + packageIdSuffix;
- var frameworkElement = { src: "LibraryPath", custom: true };
- var sub_dir = path.resolve(temp, dummy_id, packageIdSuffix + '-' + frameworkElement.src);
- var mainProjectProps = path.resolve(temp, "project.properties");
- var mainProjectManifest = path.resolve(temp, "AndroidManifest.xml");
- var existsSync = spyOn(fs, 'existsSync').andReturn(true);
+ var packageIdSuffix = 'PlugmanTest';
+ var packageId = 'io.cordova.' + packageIdSuffix;
+ var frameworkElement = { src: 'LibraryPath', custom: true };
+ path.resolve(temp, dummy_id, packageIdSuffix + '-' + frameworkElement.src);
+ var mainProjectProps = path.resolve(temp, 'project.properties');
+ var mainProjectManifest = path.resolve(temp, 'AndroidManifest.xml');
+ spyOn(fs, 'existsSync').andReturn(true);
var writeFileSync = spyOn(fs, 'writeFileSync');
spyOn(fs, 'readdirSync').andReturn([]);
var rmdirSync = spyOn(fs, 'rmdirSync');
- var removeFile = spyOn(common, 'removeFile');
- var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) {
+ spyOn(common, 'removeFile');
+ spyOn(fs, 'readFileSync').andCallFake(function (file) {
if (path.normalize(file) === mainProjectProps) {
return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2='+dummy_id+'/'+packageIdSuffix+'-LibraryPath\nandroid.library.reference.3=ExistingLibRef2\n';
} else if (path.normalize(file) === mainProjectManifest) {
return '<manifest package="' + packageId + '">';
}
- })
- var exec = spyOn(shell, 'exec');
+ });
+ spyOn(shell, 'exec');
android['framework'].uninstall(frameworkElement, temp, dummy_id);
android.parseProjectFile(temp).write();
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
index 6db3033..1e72105 100644
--- a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
+++ b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
@@ -18,15 +18,11 @@
*/
var blackberry10 = require('../../src/plugman/platforms/blackberry10'),
common = require('../../src/plugman/platforms/common'),
- install = require('../../src/plugman/install'),
path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
- et = require('elementtree'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
- plugins_dir = path.join(temp, 'cordova', 'plugins'),
- plugins_module = require('../../src/plugman/util/plugins'),
blackberry10_project = path.join(__dirname, '..', 'projects', 'blackberry10', '*');
var PluginInfo = require('../../src/PluginInfo');
@@ -64,7 +60,7 @@ describe('blackberry10 project handler', function() {
shell.rm('-rf', temp);
});
describe('of <lib-file> elements', function() {
- it("should copy so files to native/target/plugins", function () {
+ it('should copy so files to native/target/plugins', function () {
var plugin = plugins.echo,
libs = copyArray(plugin.getLibFiles('blackberry10')),
s = spyOn(common, 'copyFile');
@@ -76,7 +72,7 @@ describe('blackberry10 project handler', function() {
describe('of <source-file> elements', function() {
it('should copy stuff from one location to another by calling common.copyFile', function() {
var plugin = plugins.echo,
- source = copyArray(plugin.getSourceFiles('blackberry10'));
+ source = copyArray(plugin.getSourceFiles('blackberry10')),
s = spyOn(common, 'copyFile');
blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
@@ -140,7 +136,7 @@ describe('blackberry10 project handler', function() {
});
});
describe('of <lib-file> elements', function(done) {
- it("should remove so files from www/plugins", function () {
+ it('should remove so files from www/plugins', function () {
var s = spyOn(common, 'removeFile'),
plugin = plugins.echo;
var source = copyArray(plugin.getLibFiles('blackberry10'));
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/common.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/common.spec.js b/cordova-lib/spec-plugman/platforms/common.spec.js
index 828955b..408f070 100644
--- a/cordova-lib/spec-plugman/platforms/common.spec.js
+++ b/cordova-lib/spec-plugman/platforms/common.spec.js
@@ -15,6 +15,9 @@
* under the License.
*
*/
+
+/* jshint laxcomma:true */
+
var common = require('../../src/plugman/platforms/common')
, path = require('path')
, fs = require('fs')
@@ -35,7 +38,7 @@ describe('common platform handler', function() {
shell.mkdir('-p', test_dir);
var target = path.join(test_dir, 'somefile');
fs.writeFileSync(target, '80085', 'utf-8');
- expect(function(){common.resolveSrcPath(test_dir, 'somefile')}).not.toThrow();
+ expect(function(){common.resolveSrcPath(test_dir, 'somefile');}).not.toThrow();
shell.rm('-rf', test_dir);
});
});
@@ -43,25 +46,25 @@ describe('common platform handler', function() {
describe('resolveTargetPath', function() {
it('should throw if path exists', function(){
shell.mkdir('-p', test_dir);
- expect(function(){common.resolveTargetPath(test_dir)}).toThrow();
+ expect(function(){common.resolveTargetPath(test_dir);}).toThrow();
shell.rm('-rf', test_dir);
});
it('should not throw if path cannot be resolved', function(){
- expect(function(){common.resolveTargetPath(test_dir, 'somefile')}).not.toThrow();
+ expect(function(){common.resolveTargetPath(test_dir, 'somefile');}).not.toThrow();
});
});
describe('copyFile', function() {
it('should throw if source path not found', function(){
- expect(function(){common.copyFile(test_dir, src, project_dir, dest)}).
+ expect(function(){common.copyFile(test_dir, src, project_dir, dest);}).
toThrow(new Error('"' + src + '" not found!'));
});
it('should throw if src not in plugin directory', function(){
shell.mkdir('-p', project_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
- expect(function(){common.copyFile(test_dir, "../non_plugin_file", project_dir, dest)}).
+ expect(function(){common.copyFile(test_dir, '../non_plugin_file', project_dir, dest);}).
toThrow(new Error('"' + non_plugin_file + '" not located within plugin!'));
shell.rm('-rf', test_dir);
});
@@ -70,7 +73,7 @@ describe('common platform handler', function() {
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
fs.symlinkSync(java_file, symlink_file);
- common.copyFile(test_dir, symlink_file, project_dir, dest)
+ common.copyFile(test_dir, symlink_file, project_dir, dest);
shell.rm('-rf', project_dir);
});
@@ -78,21 +81,21 @@ describe('common platform handler', function() {
shell.mkdir('-p', java_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
fs.symlinkSync(non_plugin_file, symlink_file);
- expect(function(){common.copyFile(test_dir, symlink_file, project_dir, dest)}).
+ expect(function(){common.copyFile(test_dir, symlink_file, project_dir, dest);}).
toThrow(new Error('"' + symlink_file + '" not located within plugin!'));
shell.rm('-rf', project_dir);
});
it('should throw if target path exists', function(){
shell.mkdir('-p', dest);
- expect(function(){common.copyFile(test_dir, src, project_dir, dest)}).toThrow();
+ expect(function(){common.copyFile(test_dir, src, project_dir, dest);}).toThrow();
shell.rm('-rf', dest);
});
it('should throw if dest is outside the project directory', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
- expect(function(){common.copyFile(test_dir, java_file, project_dir, non_plugin_file)}).
+ expect(function(){common.copyFile(test_dir, java_file, project_dir, non_plugin_file);}).
toThrow(new Error('"' + non_plugin_file + '" not located within project!'));
shell.rm('-rf', project_dir);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/ios.spec.js b/cordova-lib/spec-plugman/platforms/ios.spec.js
index 472d25b..e9c3b96 100644
--- a/cordova-lib/spec-plugman/platforms/ios.spec.js
+++ b/cordova-lib/spec-plugman/platforms/ios.spec.js
@@ -16,18 +16,18 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint sub:true */
+
var ios = require('../../src/plugman/platforms/ios'),
install = require('../../src/plugman/install'),
path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
os = require('osenv'),
- plist = require('plist'),
- bplist = require('bplist-parser'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
ios_config_xml_project = path.join(__dirname, '..', 'projects', 'ios-config-xml', '*'),
- ios_plist_project = path.join(__dirname, '..', 'projects', 'ios-plist', '*'),
ios_project = path.join(ios_config_xml_project, '..'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
@@ -160,25 +160,25 @@ describe('ios project handler', function() {
}).toThrow();
});
it('should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir == undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
var spy = spyOn(proj_files.xcode, 'addSourceFile');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'), {});
});
it('should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir != undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(proj_files.xcode, 'addSourceFile');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'), {});
});
it('should cp the file to the right target location when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir == undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
});
it('should cp the file to the right target location when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir != undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
@@ -209,25 +209,25 @@ describe('ios project handler', function() {
}).toThrow();
});
it('should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir == undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
var spy = spyOn(proj_files.xcode, 'addHeaderFile');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
it('should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir != undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(proj_files.xcode, 'addHeaderFile');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
it('should cp the file to the right target location when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir == undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h'));
});
it('should cp the file to the right target location when element has a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir != undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
@@ -238,7 +238,7 @@ describe('ios project handler', function() {
it('should throw if resource-file src cannot be found', function() {
var resources = copyArray(invalid_resources);
expect(function() {
- ios['resource-file'].install(resources[0], faultyplugin, temp, "pluginid", null, proj_files);
+ ios['resource-file'].install(resources[0], faultyplugin, temp, 'pluginid', null, proj_files);
}).toThrow('cannot find "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" ios <resource-file>');
});
it('should throw if resource-file target already exists', function() {
@@ -247,19 +247,19 @@ describe('ios project handler', function() {
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
expect(function() {
- ios['resource-file'].install(resources[0], dummyplugin, temp, "pluginid",null, proj_files);
+ ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid',null, proj_files);
}).toThrow('target destination "' + target + '" already exists');
});
it('should call into xcodeproj\'s addResourceFile', function() {
var resources = copyArray(valid_resources);
var spy = spyOn(proj_files.xcode, 'addResourceFile');
- ios['resource-file'].install(resources[0], dummyplugin, temp, "pluginid", null, proj_files);
+ ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
it('should cp the file to the right target location', function() {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'cp');
- ios['resource-file'].install(resources[0], dummyplugin, temp, "pluginid", null, proj_files);
+ ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith('-R', path.join(dummyplugin, 'src', 'ios', 'DummyPlugin.bundle'), path.join(temp, 'SampleApp', 'Resources'));
});
});
@@ -322,21 +322,21 @@ describe('ios project handler', function() {
describe('uninstallation', function() {
describe('of <source-file> elements', function() {
it('should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir == undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(proj_files.xcode, 'removeSourceFile');
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'));
});
it('should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir != undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(proj_files.xcode, 'removeSourceFile');
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
it('should rm the file from the right target location when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir == undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(shell, 'rm');
@@ -344,7 +344,7 @@ describe('ios project handler', function() {
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id));
});
it('should rm the file from the right target location when element has a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir != undefined});
+ var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(shell, 'rm');
@@ -366,14 +366,14 @@ describe('ios project handler', function() {
shell.cp('-rf', ios_config_xml_project, temp);
});
it('should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir == undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
ios['header-file'].uninstall(headers[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
it('should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir != undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
@@ -381,7 +381,7 @@ describe('ios project handler', function() {
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
it('should rm the file from the right target location', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir != undefined});
+ var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'rm');
ios['header-file'].uninstall(headers[0], temp, dummy_id, null, proj_files);
@@ -397,14 +397,14 @@ describe('ios project handler', function() {
var resources = copyArray(valid_resources);
var spy = spyOn(proj_files.xcode, 'removeResourceFile');
- ios['resource-file'].uninstall(resources[0], temp, "pluginid", null, proj_files);
+ ios['resource-file'].uninstall(resources[0], temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
it('should rm the file from the right target location', function(){
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'rm');
- ios['resource-file'].uninstall(resources[0], temp, "pluginid", null, proj_files);
+ ios['resource-file'].uninstall(resources[0], temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle'));
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/tizen.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/tizen.spec.js b/cordova-lib/spec-plugman/platforms/tizen.spec.js
index 7acf4af..2e01637 100644
--- a/cordova-lib/spec-plugman/platforms/tizen.spec.js
+++ b/cordova-lib/spec-plugman/platforms/tizen.spec.js
@@ -15,14 +15,14 @@
* under the License.
*
*/
+
+
var tizen = require('../../src/plugman/platforms/tizen'),
- common = require('../../src/plugman/platforms/common'),
os = require('osenv'),
- fs = require('fs'),
- et = require('elementtree'),
path = require('path'),
- shell = require('shelljs'),
- temp = path.join( os.tmpdir(), 'plugman-' + ((function() {
+ tizen_project = path.join(__dirname, '..', 'projects', 'tizen');
+
+ path.join( os.tmpdir(), 'plugman-' + ((function() {
var index, subIndex,
set = 'abcdefghijklmnopqrstuvwxyz0123456789',
str = '';
@@ -33,8 +33,7 @@ var tizen = require('../../src/plugman/platforms/tizen'),
}
return str;
- })() )),
- tizen_project = path.join(__dirname, '..', 'projects', 'tizen');
+ })() ));
describe('Tizen project handler', function() {
describe('www_dir method', function() {
@@ -45,7 +44,7 @@ describe('Tizen project handler', function() {
describe('Manipulating project files', function() {
describe('package_name method', function() {
it('should return the id of the config.xml root element', function() {
- expect(tizen.package_name(tizen_project)).toEqual("TizenTestPackage");
+ expect(tizen.package_name(tizen_project)).toEqual('TizenTestPackage');
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/windows8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows8.spec.js b/cordova-lib/spec-plugman/platforms/windows8.spec.js
index 22eae93..ed746f3 100644
--- a/cordova-lib/spec-plugman/platforms/windows8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows8.spec.js
@@ -22,12 +22,9 @@ var windows8 = require('../../src/plugman/platforms/windows'),
path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
- et = require('elementtree'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
- xml_helpers = require('../../src/util/xml-helpers'),
- plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin'),
windows8_project = path.join(__dirname, '..', 'projects', 'windows8');
@@ -68,7 +65,7 @@ describe('windows8 project handler', function() {
});
describe('package_name method', function() {
it('should return a windows8 project\'s proper package name', function() {
- expect(windows8.package_name(windows8_project)).toEqual("CordovaApp");
+ expect(windows8.package_name(windows8_project)).toEqual('CordovaApp');
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/platforms/wp8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/wp8.spec.js b/cordova-lib/spec-plugman/platforms/wp8.spec.js
index 5dd36a8..ab791ab 100644
--- a/cordova-lib/spec-plugman/platforms/wp8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/wp8.spec.js
@@ -22,12 +22,10 @@ var wp8 = require('../../src/plugman/platforms/wp8'),
path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
- et = require('elementtree'),
os = require('osenv'),
temp = path.join(os.tmpdir(), 'plugman'),
plugins_dir = path.join(temp, 'cordova', 'plugins'),
xml_helpers = require('../../src/util/xml-helpers'),
- plugins_module = require('../../src/plugman/util/plugins'),
dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin'),
wp8_project = path.join(__dirname, '..', 'projects', 'wp8');
@@ -68,7 +66,7 @@ describe('wp8 project handler', function() {
});
describe('package_name method', function() {
it('should return a wp8 project\'s proper package name', function() {
- expect(wp8.package_name(wp8_project)).toEqual("{F3A8197B-6B16-456D-B5F4-DD4F04AC0BEC}");
+ expect(wp8.package_name(wp8_project)).toEqual('{F3A8197B-6B16-456D-B5F4-DD4F04AC0BEC}');
});
});
@@ -128,9 +126,9 @@ describe('wp8 project handler', function() {
runs(function () { installPromise(install('wp8', temp, dummyplugin, plugins_dir, {})); });
waitsFor(function () { return done; }, 'install promise never resolved', 500);
runs(function () {
- expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), "/Deployment/App", "Tokens");
- expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), "/Deployment/App/Extensions", "Extension");
- expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), "/Deployment/App/Extensions", "FileTypeAssociation;Extension");
+ expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), '/Deployment/App', 'Tokens');
+ expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), '/Deployment/App/Extensions', 'Extension');
+ expect(graftXML).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Array), '/Deployment/App/Extensions', 'FileTypeAssociation;Extension');
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/prepare.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/prepare.spec.js b/cordova-lib/spec-plugman/prepare.spec.js
index 919a7a3..c3ff707 100644
--- a/cordova-lib/spec-plugman/prepare.spec.js
+++ b/cordova-lib/spec-plugman/prepare.spec.js
@@ -16,11 +16,9 @@
specific language governing permissions and limitations
under the License.
*/
-var platforms = require('../src/plugman/platforms'),
- prepare = require('../src/plugman/prepare'),
- common = require('../src/plugman/platforms/common');
+var prepare = require('../src/plugman/prepare'),
+ common = require('../src/plugman/platforms/common'),
fs = require('fs'),
- os = require('osenv'),
path = require('path'),
shell = require('shelljs'),
config_changes = require('../src/plugman/util/config-changes'),
@@ -28,9 +26,6 @@ var platforms = require('../src/plugman/platforms'),
temp = __dirname,
plugins_dir = path.join(temp, 'plugins');
-var json = path.join(temp, 'assets', 'www', 'cordova_plugins.json');
-var js = path.join(temp, 'assets', 'www', 'cordova_plugins.js');
-
describe('prepare', function() {
var proc, platform_json, write, mkdir, rm;
beforeEach(function() {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/registry/registry.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/registry/registry.spec.js b/cordova-lib/spec-plugman/registry/registry.spec.js
index d75120c..ea4cd51 100644
--- a/cordova-lib/spec-plugman/registry/registry.spec.js
+++ b/cordova-lib/spec-plugman/registry/registry.spec.js
@@ -42,13 +42,13 @@ describe('registry', function() {
}
describe('manifest', function() {
- var pluginDir, packageJson, tmp_plugin, tmp_plugin_xml, tmp_package_json;
+ var pluginDir, tmp_plugin, tmp_plugin_xml, tmp_package_json;
beforeEach(function() {
pluginDir = __dirname + '/../plugins/com.cordova.engine';
tmp_plugin = path.join(os.tmpdir(), 'plugin');
tmp_plugin_xml = path.join(tmp_plugin, 'plugin.xml');
tmp_package_json = path.join(tmp_plugin, 'package.json');
- shell.cp('-R', pluginDir+"/*", tmp_plugin);
+ shell.cp('-R', pluginDir+'/*', tmp_plugin);
});
afterEach(function() {
shell.rm('-rf', tmp_plugin);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/uninstall-browserify.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/uninstall-browserify.spec.js b/cordova-lib/spec-plugman/uninstall-browserify.spec.js
index e598951..d8db429 100644
--- a/cordova-lib/spec-plugman/uninstall-browserify.spec.js
+++ b/cordova-lib/spec-plugman/uninstall-browserify.spec.js
@@ -16,6 +16,9 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint sub:true */
+
var uninstall = require('../src/plugman/uninstall'),
install = require('../src/plugman/install'),
actions = require('../src/plugman/util/action-stack'),
@@ -60,13 +63,13 @@ describe('start', function() {
done = false;
promise = Q()
.then(
- function(){ return install('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true }) }
+ function(){ return install('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true }); }
).then(
- function(){ return install('android', project, plugins['A'], plugins_install_dir, { browserify: true }) }
+ function(){ return install('android', project, plugins['A'], plugins_install_dir, { browserify: true }); }
).then(
- function(){ return install('android', project2, plugins['C'], plugins_install_dir2, { browserify: true }) }
+ function(){ return install('android', project2, plugins['C'], plugins_install_dir2, { browserify: true }); }
).then(
- function(){ return install('android', project2, plugins['A'], plugins_install_dir2, { browserify: true }) }
+ function(){ return install('android', project2, plugins['A'], plugins_install_dir2, { browserify: true }); }
).then(
function(){ done = true; }
).fail(function(err) {
@@ -83,8 +86,6 @@ describe('uninstallPlatform', function() {
var proc, prepare, prepareBrowserify, actions_push, add_to_queue, c_a, rm;
var fsWrite;
- var plat_common = require('../src/plugman/platforms/common');
-
beforeEach(function() {
proc = spyOn(actions.prototype, 'process').andReturn(Q());
actions_push = spyOn(actions.prototype, 'push');
@@ -167,11 +168,11 @@ describe('uninstallPlatform', function() {
});
describe('uninstallPlugin', function() {
- var rm, fsWrite, rmstack = [], emit, prepareBrowserify;
+ var rm, fsWrite, rmstack = [], emit;
beforeEach(function() {
fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
- rm = spyOn(shell, 'rm').andCallFake(function(f,p) { rmstack.push(p); return true});
+ rm = spyOn(shell, 'rm').andCallFake(function(f,p) { rmstack.push(p); return true; });
rmstack = [];
emit = spyOn(events, 'emit');
done = false;
@@ -194,7 +195,7 @@ describe('uninstallPlugin', function() {
});
});
- it("should fail if plugin is a required dependency", function() {
+ it('should fail if plugin is a required dependency', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('C', plugins_install_dir, {browserify: true}) );
});
@@ -204,7 +205,7 @@ describe('uninstallPlugin', function() {
});
});
- it("allow forcefully removing a plugin", function() {
+ it('allow forcefully removing a plugin', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('C', plugins_install_dir, {browserify: true, force: true}) );
});
@@ -216,7 +217,7 @@ describe('uninstallPlugin', function() {
});
});
- it("never remove top level plugins if they are a dependency", function() {
+ it('never remove top level plugins if they are a dependency', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('A', plugins_install_dir2, {browserify: true}) );
});
@@ -283,21 +284,21 @@ describe('end', function() {
promise.then(
function(){
- return uninstall('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true })
+ return uninstall('android', project, plugins['org.test.plugins.dummyplugin'], plugins_install_dir, { browserify: true });
}
).then(
function(){
// Fails... A depends on
- return uninstall('android', project, plugins['C'], plugins_install_dir, { browserify: true })
+ return uninstall('android', project, plugins['C'], plugins_install_dir, { browserify: true });
}
).fail(
function(err) {
- expect(err.message).toBe("The plugin 'C' is required by (A), skipping uninstallation.");
+ expect(err.message).toBe('The plugin \'C\' is required by (A), skipping uninstallation.');
}
).then(
function(){
// dependencies on C,D ... should this only work with --recursive? prompt user..?
- return uninstall('android', project, plugins['A'], plugins_install_dir, { browserify: true })
+ return uninstall('android', project, plugins['A'], plugins_install_dir, { browserify: true });
}
).fin(function(err){
if(err)
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/uninstall.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/uninstall.spec.js b/cordova-lib/spec-plugman/uninstall.spec.js
index 4f5b33d..3cb6101 100644
--- a/cordova-lib/spec-plugman/uninstall.spec.js
+++ b/cordova-lib/spec-plugman/uninstall.spec.js
@@ -16,6 +16,9 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint sub:true */
+
var uninstall = require('../src/plugman/uninstall'),
install = require('../src/plugman/install'),
actions = require('../src/plugman/util/action-stack'),
@@ -60,13 +63,13 @@ describe('start', function() {
done = false;
promise = Q()
.then(
- function(){ return install('android', project, plugins['org.test.plugins.dummyplugin']) }
+ function(){ return install('android', project, plugins['org.test.plugins.dummyplugin']); }
).then(
- function(){ return install('android', project, plugins['A']) }
+ function(){ return install('android', project, plugins['A']); }
).then(
- function(){ return install('android', project2, plugins['C']) }
+ function(){ return install('android', project2, plugins['C']); }
).then(
- function(){ return install('android', project2, plugins['A']) }
+ function(){ return install('android', project2, plugins['A']); }
).then(
function(){ done = true; }
);
@@ -81,8 +84,6 @@ describe('uninstallPlatform', function() {
var proc, prepare, actions_push, add_to_queue, c_a, rm;
var fsWrite;
- var plat_common = require('../src/plugman/platforms/common');
-
beforeEach(function() {
proc = spyOn(actions.prototype, 'process').andReturn(Q());
actions_push = spyOn(actions.prototype, 'push');
@@ -168,7 +169,7 @@ describe('uninstallPlugin', function() {
beforeEach(function() {
fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
- rm = spyOn(shell, 'rm').andCallFake(function(f,p) { rmstack.push(p); return true});
+ rm = spyOn(shell, 'rm').andCallFake(function(f,p) { rmstack.push(p); return true; });
rmstack = [];
emit = spyOn(events, 'emit');
done = false;
@@ -191,7 +192,7 @@ describe('uninstallPlugin', function() {
});
});
- it("should fail if plugin is a required dependency", function() {
+ it('should fail if plugin is a required dependency', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('C', plugins_install_dir) );
});
@@ -201,7 +202,7 @@ describe('uninstallPlugin', function() {
});
});
- it("allow forcefully removing a plugin", function() {
+ it('allow forcefully removing a plugin', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('C', plugins_install_dir, {force: true}) );
});
@@ -213,7 +214,7 @@ describe('uninstallPlugin', function() {
});
});
- it("never remove top level plugins if they are a dependency", function() {
+ it('never remove top level plugins if they are a dependency', function() {
runs(function() {
uninstallPromise( uninstall.uninstallPlugin('A', plugins_install_dir2) );
});
@@ -280,21 +281,21 @@ describe('end', function() {
promise.then(
function(){
- return uninstall('android', project, plugins['org.test.plugins.dummyplugin'])
+ return uninstall('android', project, plugins['org.test.plugins.dummyplugin']);
}
).then(
function(){
// Fails... A depends on
- return uninstall('android', project, plugins['C'])
+ return uninstall('android', project, plugins['C']);
}
).fail(
function(err) {
- expect(err.message).toBe("The plugin 'C' is required by (A), skipping uninstallation.");
+ expect(err.message).toBe('The plugin \'C\' is required by (A), skipping uninstallation.');
}
).then(
function(){
// dependencies on C,D ... should this only work with --recursive? prompt user..?
- return uninstall('android', project, plugins['A'])
+ return uninstall('android', project, plugins['A']);
}
).fin(function(err){
if(err)
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/util/action-stack.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/action-stack.spec.js b/cordova-lib/spec-plugman/util/action-stack.spec.js
index badad0b..0db4734 100644
--- a/cordova-lib/spec-plugman/util/action-stack.spec.js
+++ b/cordova-lib/spec-plugman/util/action-stack.spec.js
@@ -16,8 +16,7 @@
specific language governing permissions and limitations
under the License.
*/
-var action_stack = require('../../src/plugman/util/action-stack'),
- ios = require('../../src/plugman/platforms/ios');
+var action_stack = require('../../src/plugman/util/action-stack');
describe('action-stack', function() {
var stack;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/config-changes.spec.js b/cordova-lib/spec-plugman/util/config-changes.spec.js
index dfff4ff..b5d3358 100644
--- a/cordova-lib/spec-plugman/util/config-changes.spec.js
+++ b/cordova-lib/spec-plugman/util/config-changes.spec.js
@@ -17,7 +17,7 @@
under the License.
*/
/* jshint node:true, sub:true, indent:4 */
-/* global jasmine, describe, beforeEach, afterEach, it, spyOn, expect */
+/* global describe, beforeEach, afterEach, it, spyOn, expect */
var configChanges = require('../../src/plugman/util/config-changes'),
xml_helpers = require('../../src/util/xml-helpers'),
@@ -96,7 +96,6 @@ describe('config-changes module', function() {
describe('load method', function() {
it('should return an empty config json object if file doesn\'t exist', function() {
- var filepath = path.join(plugins_dir, 'android.json');
var platformJson = PlatformJson.load(plugins_dir, 'android');
expect(platformJson.root).toBeDefined();
expect(platformJson.root.prepare_queue).toBeDefined();
@@ -107,7 +106,7 @@ describe('config-changes module', function() {
var filepath = path.join(plugins_dir, 'android.json');
var json = {
prepare_queue: {installed: [], uninstalled: []},
- config_munge: {files: {"some_file": {parents: {"some_parent": [{"xml": "some_change", "count": 1}]}}}},
+ config_munge: {files: {'some_file': {parents: {'some_parent': [{'xml': 'some_change', 'count': 1}]}}}},
installed_plugins: {},
dependent_plugins: {}};
fs.writeFileSync(filepath, JSON.stringify(json), 'utf-8');
@@ -273,7 +272,6 @@ describe('config-changes module', function() {
});
});
describe('of plist config files', function() {
- var xcode_add, xcode_rm;
it('should write empty string nodes with no whitespace', function() {
shell.cp('-rf', ios_config_xml, temp);
shell.cp('-rf', varplugin, plugins_dir);
@@ -295,7 +293,7 @@ describe('config-changes module', function() {
});
});
describe('of pbxproject framework files', function() {
- var xcode_add, xcode_rm;
+ var xcode_add;
beforeEach(function() {
shell.cp('-rf', ios_config_xml, temp);
shell.cp('-rf', cbplugin, plugins_dir);
@@ -363,7 +361,7 @@ describe('config-changes module', function() {
shell.cp('-rf', varplugin, plugins_dir);
// Run through an "install"
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', {"API_KEY":"canucks"});
+ platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', {'API_KEY':'canucks'});
var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson, pluginInfoProvider);
munger.process();
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/util/csproj.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/csproj.spec.js b/cordova-lib/spec-plugman/util/csproj.spec.js
index 236f631..2b18715 100644
--- a/cordova-lib/spec-plugman/util/csproj.spec.js
+++ b/cordova-lib/spec-plugman/util/csproj.spec.js
@@ -17,16 +17,10 @@
under the License.
*/
var csproj = require('../../src/util/windows/csproj'),
- path = require('path'),
- os = require('osenv'),
- et = require('elementtree'),
- fs = require('fs'),
- xml_helpers = require('../../src/util/xml-helpers');
+ path = require('path');
var wp8_project = path.join(__dirname, '..', 'projects', 'wp8'),
- temp = path.join(os.tmpdir(), 'plugman'),
- example_csproj = path.join(wp8_project, 'CordovaAppProj.csproj'),
- wpcsproj = path.join(__dirname, '..', 'plugins', 'WPcsproj');
+ example_csproj = path.join(wp8_project, 'CordovaAppProj.csproj');
describe('csproj', function() {
it('should throw if passed in an invalid xml file path ref', function() {
@@ -48,7 +42,6 @@ describe('csproj', function() {
describe('source file', function() {
- var test_csproj;
var page_test = path.join('src', 'UI', 'PageTest.xaml');
var page_test_cs = path.join('src', 'UI', 'PageTest.xaml.cs');
var lib_test = path.join('lib', 'LibraryTest.dll');
@@ -106,7 +99,7 @@ describe('csproj', function() {
var group = item_groups[i];
expect(group._children.length).toBeGreaterThan(0);
}
- })
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/util/dependencies.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/dependencies.spec.js b/cordova-lib/spec-plugman/util/dependencies.spec.js
index dfec42f..5861665 100644
--- a/cordova-lib/spec-plugman/util/dependencies.spec.js
+++ b/cordova-lib/spec-plugman/util/dependencies.spec.js
@@ -18,8 +18,7 @@
*/
var dependencies = require('../../src/plugman/util/dependencies'),
xml_helpers = require('../../src/util/xml-helpers'),
- path = require('path'),
- config = require('../../src/plugman/util/config-changes');
+ path = require('path');
var PlatformJson = require('../../src/plugman/util/PlatformJson');
var PluginInfoProvider = require('../../src/PluginInfoProvider');
@@ -27,9 +26,9 @@ describe('dependency module', function() {
describe('generateDependencyInfo method', function() {
it('should return a list of top-level plugins based on what is inside a platform.json file', function() {
var tlps = {
- "hello":"",
- "isitme":"",
- "yourelookingfor":""
+ 'hello':'',
+ 'isitme':'',
+ 'yourelookingfor':''
};
var platformJson = new PlatformJson('filePath', 'platform', {
installed_plugins:tlps,
@@ -37,7 +36,7 @@ describe('dependency module', function() {
});
var pluginInfoProvider = new PluginInfoProvider();
Object.keys(tlps).forEach(function(k) {
- pluginInfoProvider.put({id:k, dir: path.join('plugins_dir', k), getDependencies: function() {return[]}});
+ pluginInfoProvider.put({id:k, dir: path.join('plugins_dir', k), getDependencies: function() {return[];}});
});
spyOn(xml_helpers, 'parseElementtreeSync').andReturn({findall:function(){}});
var obj = dependencies.generateDependencyInfo(platformJson, 'plugins_dir', pluginInfoProvider);
@@ -45,13 +44,8 @@ describe('dependency module', function() {
});
it('should return a dependency graph for the plugins', function() {
var tlps = {
- "A":"",
- "B":""
- };
- var deps = {
- "C":"",
- "D":"",
- "E":""
+ 'A':'',
+ 'B':''
};
var plugins_dir = path.join(__dirname, '..', 'plugins', 'dependencies');
var platformJson = new PlatformJson(plugins_dir, 'android', {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/35391350/cordova-lib/spec-plugman/util/plugins.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/plugins.spec.js b/cordova-lib/spec-plugman/util/plugins.spec.js
index 2dc341a..f8930e9 100644
--- a/cordova-lib/spec-plugman/util/plugins.spec.js
+++ b/cordova-lib/spec-plugman/util/plugins.spec.js
@@ -17,10 +17,8 @@
*
*/
-var http = require('http'),
- osenv = require('osenv'),
+var osenv = require('osenv'),
path = require('path'),
- fs = require('fs'),
temp = path.join(osenv.tmpdir(), 'plugman'),
shell = require('shelljs'),
child_process = require('child_process'),
@@ -28,7 +26,6 @@ var http = require('http'),
plugins = require('../../src/plugman/util/plugins');
var et = require('elementtree');
-var PluginInfoProvider = require('../../src/PluginInfoProvider');
describe('plugins utility module', function(){
describe('clonePluginGitRepo', function(){
@@ -46,7 +43,6 @@ describe('plugins utility module', function(){
});
it('should shell out to git clone with correct arguments', function(){
var plugin_git_url = 'https://github.com/imhotep/org.test.plugins.childbrowser';
- var callback = jasmine.createSpy();
runs(function() {
plugins.clonePluginGitRepo(plugin_git_url, temp, '.', undefined, null)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org