How to use the cordova-common.PluginInfoProvider function in cordova-common

To help you get started, we’ve selected a few cordova-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intel-iot-devkit / android-things-samples / Zombie / ZombieDetector / platforms / android / cordova / lib / prepare.js View on Github external
module.exports.prepare = function (cordovaProject, options) {
    var self = this;

    var platformJson = PlatformJson.load(this.locations.root, this.platform);
    var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());

    this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);

    // Update own www dir with project's www assets and plugins' assets and js-files
    return Q.when(updateWww(cordovaProject, this.locations))
    .then(function () {
        // update project according to config.xml changes.
        return updateProjectAccordingTo(self._config, self.locations);
    })
    .then(function () {
        updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
        updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
    })
    .then(function () {
        events.emit('verbose', 'Prepared android project successfully');
    });
github katzer / cordova-plugin-badge / platforms / android / cordova / lib / prepare.js View on Github external
module.exports.prepare = function (cordovaProject, options) {
    var self = this;

    var platformJson = PlatformJson.load(this.locations.root, this.platform);
    var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());

    this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);

    // Update own www dir with project's www assets and plugins' assets and js-files
    return Q.when(updateWww(cordovaProject, this.locations)).then(function () {
        // update project according to config.xml changes.
        return updateProjectAccordingTo(self._config, self.locations);
    }).then(function () {
        updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
        updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
        updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
    }).then(function () {
        events.emit('verbose', 'Prepared android project successfully');
    });
};
github apache / cordova-lib / src / cordova / plugin / util.js View on Github external
function getInstalledPlugins (projectRoot) {
    var pluginsDir = path.join(projectRoot, 'plugins');
    // TODO: This should list based off of platform.json, not directories within plugins/
    var pluginInfoProvider = new PluginInfoProvider();
    return pluginInfoProvider.getAllWithinSearchPath(pluginsDir);
}
github apache / cordova-lib / src / cordova / plugin / save.js View on Github external
if (pluginSource.hasOwnProperty('id')) {
        // Note that currently version is only saved here if it was explicitly specified when the plugin was added.
        var parsedSpec = pluginSpec.parse(pluginSource.id);
        version = parsedSpec.version;
        if (version) {
            version = module.exports.versionString(version);
        }

        if (parsedSpec.scope) {
            scopedPackage = parsedSpec.package;
        }
    }

    if (!version) {
        // Fallback on getting version from the plugin folder, if it's there
        var pluginInfoProvider = new PluginInfoProvider();
        var dir = path.join(projectRoot, 'plugins', pluginName);

        try {
            // pluginInfoProvider.get() will throw if directory does not exist.
            var pluginInfo = pluginInfoProvider.get(dir);
            if (pluginInfo) {
                version = module.exports.versionString(pluginInfo.version);
            }
        } catch (err) {
        }
    }

    if (scopedPackage) {
        version = scopedPackage + '@' + version;
    }
github apache / cordova-lib / cordova-lib / src / cordova / plugin.js View on Github external
.then(function() {
                    var pluginInfoProvider = new PluginInfoProvider();
                    return opts.plugins.reduce(function(soFar, target) {
                        return soFar.then(function() {
                            if (target[target.length - 1] == path.sep) {
                                target = target.substring(0, target.length - 1);
                            }

                            // Fetch the plugin first.
                            var fetchOptions = {
                                searchpath: searchPath,
                                noregistry: opts.noregistry,
                                fetch: opts.fetch || false,
                                save: opts.save,
                                nohooks: opts.nohooks,
                                link: opts.link,
                                pluginInfoProvider: pluginInfoProvider,
                                variables: opts.cli_variables,
github katzer / cordova-plugin-badge / platforms / ios / cordova / lib / prepare.js View on Github external
module.exports.prepare = function (cordovaProject, options) {
    var self = this;

    var platformJson = PlatformJson.load(this.locations.root, 'ios');
    var munger = new PlatformMunger('ios', this.locations.root, platformJson, new PluginInfoProvider());

    this._config = updateConfigFile(cordovaProject.projectConfig, munger, this.locations);

    // Update own www dir with project's www assets and plugins' assets and js-files
    return Q.when(updateWww(cordovaProject, this.locations))
        .then(function () {
            // update project according to config.xml changes.
            return updateProject(self._config, self.locations);
        })
        .then(function () {
            updateIcons(cordovaProject, self.locations);
            updateSplashScreens(cordovaProject, self.locations);
            updateLaunchStoryboardImages(cordovaProject, self.locations);
            updateFileResources(cordovaProject, self.locations);
        })
        .then(function () {
github apache / cordova-lib / cordova-lib / spec-plugman / util / dependencies.spec.js View on Github external
it('Test 001 : should return a list of top-level plugins based on what is inside a platform.json file', function() {
            var tlps = {
                'hello':'',
                'isitme':'',
                'yourelookingfor':''
            };
            var platformJson = new PlatformJson('filePath', 'platform', {
                installed_plugins:tlps,
                dependent_plugins:[]
            });
            var pluginInfoProvider = new PluginInfoProvider();
            Object.keys(tlps).forEach(function(k) {
                pluginInfoProvider.put({id:k, dir: path.join('plugins_dir', k), getDependencies: function() {return[];}});
            });
            spyOn(xml_helpers, 'parseElementtreeSync').and.returnValue({findall:function(){}});
            var obj = dependencies.generateDependencyInfo(platformJson, 'plugins_dir', pluginInfoProvider);
            expect(obj.top_level_plugins).toEqual(Object.keys(tlps));
        });
        it('Test 002 : should return a dependency graph for the plugins', function() {
github apache / cordova-lib / src / hooks / scriptsFinder.js View on Github external
function getAllPluginsHookScriptFiles (hook, opts) {
    var scripts = [];
    var currentPluginOptions;

    var plugins = (new PluginInfoProvider()).getAllWithinSearchPath(path.join(opts.projectRoot, 'plugins'));

    plugins.forEach(function (pluginInfo) {
        currentPluginOptions = {
            id: pluginInfo.id,
            pluginInfo: pluginInfo,
            dir: pluginInfo.dir
        };

        scripts = scripts.concat(getPluginScriptFiles(currentPluginOptions, hook, opts.cordova.platforms));
    });
    return scripts;
}
github katzer / cordova-plugin-badge / node_modules / cordova-osx / bin / templates / scripts / cordova / lib / configMunger.js View on Github external
get: function (platformRoot) {
        if (!_instance) {
            _instance = new PlatformMunger('osx', platformRoot, PlatformJson.load(platformRoot, 'osx'),
                new PluginInfoProvider());
        }

        return _instance;
    }
};
github apache / cordova-lib / cordova-lib / src / hooks / scriptsFinder.js View on Github external
function getAllPluginsHookScriptFiles(hook, opts) {
    var scripts = [];
    var currentPluginOptions;

    var plugins = (new PluginInfoProvider()).getAllWithinSearchPath(path.join(opts.projectRoot, 'plugins'));

    plugins.forEach(function(pluginInfo) {
        currentPluginOptions = {
            id: pluginInfo.id,
            pluginInfo: pluginInfo,
            dir: pluginInfo.dir
        };

        scripts = scripts.concat(getPluginScriptFiles(currentPluginOptions, hook, opts.cordova.platforms));
    });
    return scripts;
}