You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/05/16 00:16:49 UTC
git commit: axed old remove modules, fixed up android handler specs.
Updated Branches:
refs/heads/dependencies 79d9ea982 -> 05c085d12
axed old remove modules, fixed up android handler specs.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/05c085d1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/05c085d1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/05c085d1
Branch: refs/heads/dependencies
Commit: 05c085d125a6cab6141231de0310629219dd9bd4
Parents: 79d9ea9
Author: Fil Maj <ma...@gmail.com>
Authored: Wed May 15 15:12:54 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed May 15 15:12:54 2013 -0700
----------------------------------------------------------------------
plugman.js | 1 -
spec/platforms/android.spec.js | 26 +++++++++++++-------------
spec/remove.spec.js | 30 ------------------------------
src/remove.js | 14 --------------
4 files changed, 13 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/05c085d1/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 98e0cf4..a033545 100755
--- a/plugman.js
+++ b/plugman.js
@@ -21,7 +21,6 @@
module.exports = {
install: require('./src/install'),
uninstall:require('./src/uninstall'),
- remove: require('./src/remove'),
fetch: require('./src/fetch'),
prepare: require('./src/prepare')
};
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/05c085d1/spec/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/android.spec.js b/spec/platforms/android.spec.js
index 57ed4c9..f65caa3 100644
--- a/spec/platforms/android.spec.js
+++ b/spec/platforms/android.spec.js
@@ -47,14 +47,15 @@ function copyArray(arr) {
}
describe('android project handler', function() {
- it('should have an install function', function() {
- expect(typeof android.install).toEqual('function');
- });
- it('should have an uninstall function', function() {
- expect(typeof android.uninstall).toEqual('function');
+ describe('www_dir method', function() {
+ it('should return cordova-android project www location using www_dir', function() {
+ expect(android.www_dir('/')).toEqual('/assets/www');
+ });
});
- it('should return cordova-android project www location using www_dir', function() {
- expect(android.www_dir('/')).toEqual('/assets/www');
+ describe('package_name method', function() {
+ it('should return an android project\'s proper package name', function() {
+ expect(android.package_name(path.join(android_one_project, '..'))).toEqual('com.alunny.childapp');
+ });
});
describe('installation', function() {
@@ -72,13 +73,13 @@ describe('android project handler', function() {
it('should copy stuff from one location to another by calling common.copyFile', function() {
var source = copyArray(valid_source);
var s = spyOn(common, 'copyFile');
- android.install(source, dummy_id, temp, dummyplugin, {});
+ android['source-file'].install(source[0], dummyplugin, temp);
expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin.java', temp, 'src/com/phonegap/plugins/dummyplugin/DummyPlugin.java');
});
it('should throw if source file cannot be found', function() {
var source = copyArray(invalid_source);
expect(function() {
- android.install(source, faulty_id, temp, faultyplugin, {});
+ android['source-file'].install(source[0], faultyplugin, temp);
}).toThrow('"' + path.resolve(faultyplugin, 'src/android/NotHere.java') + '" not found!');
});
it('should throw if target file already exists', function() {
@@ -90,7 +91,7 @@ describe('android project handler', function() {
var source = copyArray(valid_source);
expect(function() {
- android.install(source, dummy_id, temp, dummyplugin, {});
+ android['source-file'].install(source[0], dummyplugin, temp);
}).toThrow('"' + target + '" already exists!');
});
});
@@ -101,7 +102,6 @@ describe('android project handler', function() {
shell.mkdir('-p', temp);
shell.mkdir('-p', plugins_dir);
shell.cp('-rf', android_two_project, temp);
- shell.cp('-rf', dummyplugin, plugins_dir);
});
afterEach(function() {
shell.rm('-rf', temp);
@@ -109,9 +109,9 @@ describe('android project handler', function() {
describe('of <source-file> elements', function() {
it('should remove stuff by calling common.deleteJava', function(done) {
var s = spyOn(common, 'deleteJava');
- install('android', temp, 'DummyPlugin', plugins_dir, {}, undefined, function() {
+ install('android', temp, dummyplugin, plugins_dir, '.', {}, undefined, function() {
var source = copyArray(valid_source);
- android.uninstall(source, dummy_id, temp, path.join(plugins_dir, 'DummyPlugin'));
+ android['source-file'].uninstall(source[0], temp);
expect(s).toHaveBeenCalledWith(temp, 'src/com/phonegap/plugins/dummyplugin/DummyPlugin.java');
done();
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/05c085d1/spec/remove.spec.js
----------------------------------------------------------------------
diff --git a/spec/remove.spec.js b/spec/remove.spec.js
deleted file mode 100644
index 4553b85..0000000
--- a/spec/remove.spec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-var remove = require('../src/remove'),
- fetch = require('../src/fetch'),
- fs = require('fs'),
- os = require('osenv'),
- path = require('path'),
- shell = require('shelljs'),
- temp = path.join(os.tmpdir(), 'plugman'),
- test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser');
-
-describe('remove', function() {
- var copied_plugin_path = path.join(temp,'com.phonegap.plugins.childbrowser');
-
- beforeEach(function() {
- shell.mkdir('-p', temp);
- });
- afterEach(function() {
- try{shell.rm('-rf', temp);}catch(e){}
- });
-
- it('should remove symbolically-linked plugins', function() {
- fetch(test_plugin, temp, true);
- remove('com.phonegap.plugins.childbrowser', temp);
- expect(fs.readdirSync(temp).length).toEqual(0);
- });
- it('should remove non-linked plugins', function() {
- fetch(test_plugin, temp, false);
- remove('com.phonegap.plugins.childbrowser', temp);
- expect(fs.readdirSync(temp).length).toEqual(0);
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/05c085d1/src/remove.js
----------------------------------------------------------------------
diff --git a/src/remove.js b/src/remove.js
deleted file mode 100644
index ada9afa..0000000
--- a/src/remove.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var shell = require('shelljs'),
- fs = require('fs'),
- path = require('path');
-
-module.exports = function removePlugin(name, plugins_dir) {
- var target = path.join(plugins_dir, name);
- var stat = fs.lstatSync(target);
-
- if (stat.isSymbolicLink()) {
- fs.unlinkSync(target);
- } else {
- shell.rm('-rf', target);
- }
-};