Updated Branches: refs/heads/master b5ba62d82 -> 2d4ab6cf5
CB-4786 adding owner and checking in some spec requirements Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/95745c25 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/95745c25 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/95745c25 Branch: refs/heads/master Commit: 95745c2510e7e3890ad26b57820766d5cd3eb898 Parents: 6486e7f Author: Anis Kadri <[email protected]> Authored: Wed Sep 11 16:25:53 2013 -0700 Committer: Anis Kadri <[email protected]> Committed: Wed Sep 11 16:25:53 2013 -0700 ---------------------------------------------------------------------- plugman.js | 4 ++ spec/owner.spec.js | 11 ++++ spec/plugins/dependencies/E/plugin.xml | 59 ++++++++++++++++++++ spec/plugins/dependencies/E/src/android/E.java | 0 .../dependencies/E/src/ios/EPluginCommand.h | 0 .../dependencies/E/src/ios/EPluginCommand.m | 0 spec/plugins/dependencies/E/www/plugin-d.js | 0 src/owner.js | 15 +++++ src/registry/registry.js | 14 +++++ 9 files changed, 103 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/plugman.js ---------------------------------------------------------------------- diff --git a/plugman.js b/plugman.js index 4ca7846..bcd0044 100755 --- a/plugman.js +++ b/plugman.js @@ -33,6 +33,7 @@ plugman = { unpublish: require('./src/unpublish'), search: require('./src/search'), info: require('./src/info'), + owner: require('./src/owner'), config_changes: require('./src/util/config-changes'), on: emitter.addListener, off: emitter.removeListener, @@ -44,6 +45,9 @@ plugman.commands = { 'config' : function(cli_opts) { plugman.config(cli_opts.argv.remain); }, + 'owner' : function(cli_opts) { + plugman.owner(cli_opts.argv.remain); + }, 'install' : function(cli_opts) { if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) { return console.log(plugman.help()); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/owner.spec.js ---------------------------------------------------------------------- diff --git a/spec/owner.spec.js b/spec/owner.spec.js new file mode 100644 index 0000000..3cc3c0a --- /dev/null +++ b/spec/owner.spec.js @@ -0,0 +1,11 @@ +var owner = require('../src/owner'), + registry = require('../src/registry/registry'); + +describe('owner', function() { + it('should run owner', function() { + var sOwner = spyOn(registry, 'owner'); + var params = ['add', 'anis', 'com.phonegap.plugins.dummyplugin']; + owner(params, function(err, result) { }); + expect(sOwner).toHaveBeenCalledWith(params, jasmine.any(Function)); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/plugin.xml ---------------------------------------------------------------------- diff --git a/spec/plugins/dependencies/E/plugin.xml b/spec/plugins/dependencies/E/plugin.xml new file mode 100644 index 0000000..586c74e --- /dev/null +++ b/spec/plugins/dependencies/E/plugin.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2013 Anis Kadri + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> + +<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0" + xmlns:android="http://schemas.android.com/apk/res/android" + id="E" + version="0.6.0"> + + <name>Plugin E</name> + + <asset src="www/plugin-e.js" target="plugin-e.js" /> + + <dependency id="D" /> + + <config-file target="config.xml" parent="/*"> + <access origin="build.phonegap.com" /> + </config-file> + + <!-- android --> + <platform name="android"> + <config-file target="res/xml/config.xml" parent="plugins"> + <plugin name="E" + value="com.phonegap.E.E"/> + </config-file> + + <source-file src="src/android/E.java" + target-dir="src/com/phonegap/E" /> + </platform> + + + <!-- ios --> + <platform name="ios"> + <!-- CDV 2.5+ --> + <config-file target="config.xml" parent="plugins"> + <plugin name="E" + value="EPluginCommand"/> + </config-file> + + <header-file src="src/ios/EPluginCommand.h" /> + <source-file src="src/ios/EPluginCommand.m"/> + </platform> +</plugin> http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/android/E.java ---------------------------------------------------------------------- diff --git a/spec/plugins/dependencies/E/src/android/E.java b/spec/plugins/dependencies/E/src/android/E.java new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/ios/EPluginCommand.h ---------------------------------------------------------------------- diff --git a/spec/plugins/dependencies/E/src/ios/EPluginCommand.h b/spec/plugins/dependencies/E/src/ios/EPluginCommand.h new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/ios/EPluginCommand.m ---------------------------------------------------------------------- diff --git a/spec/plugins/dependencies/E/src/ios/EPluginCommand.m b/spec/plugins/dependencies/E/src/ios/EPluginCommand.m new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/www/plugin-d.js ---------------------------------------------------------------------- diff --git a/spec/plugins/dependencies/E/www/plugin-d.js b/spec/plugins/dependencies/E/www/plugin-d.js new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/src/owner.js ---------------------------------------------------------------------- diff --git a/src/owner.js b/src/owner.js new file mode 100644 index 0000000..f80f4e6 --- /dev/null +++ b/src/owner.js @@ -0,0 +1,15 @@ +var registry = require('./registry/registry') + +module.exports = function(params, callback) { + registry.owner(params, function(err) { + if(callback && typeof callback === 'function') { + err ? callback(err) : callback(null); + } else { + if(err) { + throw err; + } else { + console.log('done'); + } + } + }); +} http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/src/registry/registry.js ---------------------------------------------------------------------- diff --git a/src/registry/registry.js b/src/registry/registry.js index ec662ad..15d8b84 100644 --- a/src/registry/registry.js +++ b/src/registry/registry.js @@ -122,6 +122,20 @@ module.exports = { }); }, /** + * @method owner + * @param {Array} args Command argument + * @param {Function} cb Command callback + */ + owner: function(args, cb) { + initSettings(function(err, settings) { + if(err) return handleError(err, cb); + npm.load(settings, function(er) { + if (er) return handleError(er); + npm.commands.owner(args, cb); + }); + }); + }, + /** * @method adduser * @param {Array} args Command argument * @param {Function} cb Command callback
