Example #1
0
                    targets.forEach(function(target, index) {
                        // Check if we have the plugin.
                        if (plugins.indexOf(target) > -1) {
                            var targetPath = path.join(pluginPath, target);
                            // Check if there is at least one match between plugin
                            // supported platforms and app platforms
                            var pluginXml = new cordova_util.plugin_parser(path.join(targetPath, 'plugin.xml'));
                            var intersection = pluginXml.platforms.filter(function(e) {
                                if (platformList.indexOf(e) == -1) return false;
                                else return true;
                            });

                            // Iterate over all installed platforms and uninstall.
                            // If this is a web-only or dependency-only plugin, then
                            // there may be nothing to do here except remove the
                            // reference from the platform's plugin config JSON.
                            platformList.forEach(function(platform) {
                                var platformRoot = path.join(projectRoot, 'platforms', platform);
                                var parser = new platforms[platform].parser(platformRoot);
                                events.emit('log', 'Calling plugman.uninstall on plugin "' + target + '" for platform "' + platform + '"');
                                plugman.uninstall.uninstallPlatform(platform, platformRoot, target, path.join(projectRoot, 'plugins'), { www_dir: parser.staging_dir() });
                            });
                            plugman.uninstall.uninstallPlugin(target, path.join(projectRoot, 'plugins'), end);
                        } else {
                            var err = new Error('Plugin "' + target + '" not added to project.');
                            if (callback) callback(err);
                            else throw err;
                            return;
                        }
                    });
Example #2
0
 platformList.forEach(function(platform) {
     var platformRoot = path.join(projectRoot, 'platforms', platform);
     var parser = new platforms[platform].parser(platformRoot);
     events.emit('log', 'Calling plugman.uninstall on plugin "' + target + '" for platform "' + platform + '"');
     plugman.uninstall.uninstallPlatform(platform, platformRoot, target, path.join(projectRoot, 'plugins'), { www_dir: parser.staging_dir() });
 });