Skip to content
Permalink
Browse files
Use events.emit instead of re-importing plugman each time
Looks like the re-import is no longer needed after this change
github.com/apache/cordova-plugman/commit/ae2ce7ac6325d1c6558365b4be82e5a8ff0983b9
the problem was probably due to
plugman.emit = emitter.emit
without binding the "this" for emit to the emitter.
Got no clue why the re-import is hiding that problem.
  • Loading branch information
kamrik committed Apr 14, 2014
1 parent 28318d8 commit 961ccd7cd22d43f4b75145d916afec395dd0db56
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 62 deletions.
@@ -20,6 +20,7 @@
var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

module.exports = {
@@ -46,10 +47,10 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-fileinstall is not supported for amazon-fireos');
events.emit('verbose', 'header-fileinstall is not supported for amazon-fireos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for amazon-fireos');
events.emit('verbose', 'header-file.uninstall is not supported for amazon-fireos');
}
},
"lib-file":{
@@ -68,7 +69,7 @@ module.exports = {
install:function(el, plugin_dir, project_dir, plugin_id) {
var src = el.attrib.src;
var target = el.attrib.target;
require('../../plugman').emit('verbose', 'Copying resource file ' + src + ' to ' + target);
events.emit('verbose', 'Copying resource file ' + src + ' to ' + target);
common.copyFile(plugin_dir, src, project_dir, target);
},
uninstall:function(el, project_dir, plugin_id) {
@@ -78,10 +79,10 @@ module.exports = {
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for amazon-fireos');
events.emit('verbose', 'framework.install is not supported for amazon-fireos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for amazon-fireos');
events.emit('verbose', 'framework.uninstall is not supported for amazon-fireos');
}
}
};
@@ -20,6 +20,7 @@
var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

module.exports = {
@@ -47,10 +48,10 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.install is not supported for android');
events.emit('verbose', 'header-file.install is not supported for android');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for android');
events.emit('verbose', 'header-file.uninstall is not supported for android');
}
},
"lib-file":{
@@ -69,7 +70,7 @@ module.exports = {
install:function(el, plugin_dir, project_dir, plugin_id) {
var src = el.attrib.src;
var target = el.attrib.target;
require('../../plugman').emit('verbose', 'Copying resource file ' + src + ' to ' + target);
events.emit('verbose', 'Copying resource file ' + src + ' to ' + target);
common.copyFile(plugin_dir, src, project_dir, path.normalize(target));
},
uninstall:function(el, project_dir, plugin_id) {
@@ -79,10 +80,10 @@ module.exports = {
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for android');
events.emit('verbose', 'framework.install is not supported for android');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for android');
events.emit('verbose', 'framework.uninstall is not supported for android');
}
}
};
@@ -20,6 +20,7 @@
var fs = require('fs') // use existsSync in 0.6.x
, path = require('path')
, common = require('./common')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

var TARGETS = ["device", "simulator"];
@@ -54,10 +55,10 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.install is not supported for blackberry');
events.emit('verbose', 'header-file.install is not supported for blackberry');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for blackberry');
events.emit('verbose', 'header-file.uninstall is not supported for blackberry');
}
},
"lib-file":{
@@ -76,18 +77,18 @@ module.exports = {
},
"resource-file":{
install:function(el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.install is not supported for blackberry');
events.emit('verbose', 'resource-file.install is not supported for blackberry');
},
uninstall:function(el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.uninstall is not supported for blackberry');
events.emit('verbose', 'resource-file.uninstall is not supported for blackberry');
}
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for blackberry');
events.emit('verbose', 'framework.install is not supported for blackberry');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for blackberry');
events.emit('verbose', 'framework.uninstall is not supported for blackberry');
}
}
};
@@ -1,6 +1,7 @@
var path = require('path')
, fs = require('fs')
, common = require('./common')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

module.exports = {
@@ -16,7 +17,7 @@ module.exports = {
if (!fs.existsSync(old_config_path)) {
// output newer location and fail reading
config_path = preferred_path;
require('../../plugman').emit('verbose', 'unable to find '+config_path);
events.emit('verbose', 'unable to find '+config_path);
} else {
config_path = old_config_path;
}
@@ -38,34 +39,34 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-fileinstall is not supported for firefoxos');
events.emit('verbose', 'header-fileinstall is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'header-file.uninstall is not supported for firefoxos');
}
},
"resource-file":{
install:function(el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.install is not supported for firefoxos');
events.emit('verbose', 'resource-file.install is not supported for firefoxos');
},
uninstall:function(el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
}
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for firefoxos');
events.emit('verbose', 'framework.install is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for firefoxos');
events.emit('verbose', 'framework.uninstall is not supported for firefoxos');
}
},
"lib-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.install is not supported for firefoxos');
events.emit('verbose', 'lib-file.install is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'lib-file.uninstall is not supported for firefoxos');
}
}
};
@@ -23,6 +23,7 @@ var path = require('path')
, xcode = require('xcode')
, plist = require('plist-with-patches')
, shell = require('shelljs')
, events = require('../events')
, cachedProjectFiles = {};

module.exports = {
@@ -141,10 +142,10 @@ module.exports = {
},
"lib-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.install is not supported for ios');
events.emit('verbose', 'lib-file.install is not supported for ios');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.uninstall is not supported for ios');
events.emit('verbose', 'lib-file.uninstall is not supported for ios');
}
},
parseProjectFile:function(project_dir) {
@@ -1,6 +1,7 @@
var path = require('path')
, fs = require('fs')
, common = require('./common')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

module.exports = {
@@ -16,7 +17,7 @@ module.exports = {
if (!fs.existsSync(old_config_path)) {
// output newer location and fail reading
config_path = preferred_path;
require('../../plugman').emit('verbose', 'unable to find '+config_path);
events.emit('verbose', 'unable to find '+config_path);
} else {
config_path = old_config_path;
}
@@ -38,34 +39,34 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-fileinstall is not supported for firefoxos');
events.emit('verbose', 'header-fileinstall is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'header-file.uninstall is not supported for firefoxos');
}
},
"resource-file":{
install:function(el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.install is not supported for firefoxos');
events.emit('verbose', 'resource-file.install is not supported for firefoxos');
},
uninstall:function(el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
}
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for firefoxos');
events.emit('verbose', 'framework.install is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for firefoxos');
events.emit('verbose', 'framework.uninstall is not supported for firefoxos');
}
},
"lib-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.install is not supported for firefoxos');
events.emit('verbose', 'lib-file.install is not supported for firefoxos');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.uninstall is not supported for firefoxos');
events.emit('verbose', 'lib-file.uninstall is not supported for firefoxos');
}
}
};
@@ -29,6 +29,7 @@ function toCamelCase(str) {

var fs = require('fs')
, path = require('path')
, events = require('../events')
, xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));

module.exports = {
@@ -106,18 +107,18 @@ module.exports = {
},
"framework": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.install is not supported for ubuntu');
events.emit('verbose', 'framework.install is not supported for ubuntu');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'framework.uninstall is not supported for ubuntu');
events.emit('verbose', 'framework.uninstall is not supported for ubuntu');
}
},
"lib-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.install is not supported for ubuntu');
events.emit('verbose', 'lib-file.install is not supported for ubuntu');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'lib-file.uninstall is not supported for ubuntu');
events.emit('verbose', 'lib-file.uninstall is not supported for ubuntu');
}
}
};
@@ -23,6 +23,7 @@ var common = require('./common'),
shell = require('shelljs'),
fs = require('fs'),
w8jsproj = require('../util/w8jsproj'),
events = require('../events'),
xml_helpers = require('../util/xml-helpers');


@@ -63,15 +64,15 @@ module.exports = {
},
"header-file": {
install:function(source_el, plugin_dir, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-fileinstall is not supported for Windows 8');
events.emit('verbose', 'header-fileinstall is not supported for Windows 8');
},
uninstall:function(source_el, project_dir, plugin_id) {
require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for Windows 8');
events.emit('verbose', 'header-file.uninstall is not supported for Windows 8');
}
},
"resource-file":{
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
require('../../plugman').emit('verbose', 'resource-file is not supported for Windows 8');
events.emit('verbose', 'resource-file is not supported for Windows 8');
},
uninstall:function(el, project_dir, plugin_id, project_file) {
}
@@ -82,14 +83,14 @@ module.exports = {
project_file.addSDKRef(inc);
},
uninstall:function(el, project_dir, plugin_id, project_file) {
require('../../plugman').emit('verbose', 'windows8 lib-file uninstall :: ' + plugin_id);
events.emit('verbose', 'windows8 lib-file uninstall :: ' + plugin_id);
var inc = el.attrib['Include'];
project_file.removeSDKRef(inc);
}
},
"framework": {
install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
require('../../plugman').emit('verbose', 'windows8 framework install :: ' + plugin_id);
events.emit('verbose', 'windows8 framework install :: ' + plugin_id);

var src = el.attrib['src'];
var dest = src; // if !isCustom, we will just add a reference to the file in place
@@ -109,7 +110,7 @@ module.exports = {

},
uninstall:function(el, project_dir, plugin_id, project_file) {
require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' + plugin_id );
events.emit('verbose', 'windows8 framework uninstall :: ' + plugin_id );

var src = el.attrib['src'];
// technically it is not possible to get here without isCustom == true -jm

0 comments on commit 961ccd7

Please sign in to comment.