Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Created August 13, 2015 14:34
Show Gist options
  • Save manekinekko/be422441a0a90f0057da to your computer and use it in GitHub Desktop.
Save manekinekko/be422441a0a90f0057da to your computer and use it in GitHub Desktop.
This script uses the `plugins/fetch.json` cordova file to batch install all the required plugins at once.
#!/usr/bin/env node
//this hook installs all your plugins
// add your plugins to this list--either
// the identifier, the filesystem location
// or the URL
var plugins = require('./plugins/fetch.json');
var pluginlist = [];
for( var prop in plugins) {
if(plugins[prop].source.id){
pluginlist.push(plugins[prop].source.id);
}
else {
pluginlist.push(plugins[prop].source.url);
}
}
// no need to configure below
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {
sys.puts(stdout);
}
pluginlist.forEach(function(plug) {
exec("cordova plugin add " + plug, puts);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment