Skip to content

Commit

Permalink
hanlde empty plugins array or string
Browse files Browse the repository at this point in the history
  • Loading branch information
csantanapr committed Nov 26, 2013
1 parent b054442 commit 4248fe4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ npm-debug.log
tmp
.cordova
myHybridAppFolder
cordova
10 changes: 10 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ module.exports = function (grunt) {
name: 'HelloCordova'
}
},
cordova2: {
options: {
command: ['create','platform','plugin'],
platforms: ['ios'],
plugins: [],
path: 'cordova',
id: 'io.cordova.hellocordova',
name: 'HelloCordova'
}
},
create: {
options: {
command: 'create',
Expand Down
7 changes: 6 additions & 1 deletion tasks/cordovacli.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ module.exports = function (grunt) {
//plugin(s) [{add|remove|rm} <PATH|URI>]
var tasks = [];
tasks.length = 0;

if(grunt.util.kindOf(options.plugins) !== 'array'){
options.plugins = [options.plugins];
}

options.plugins.forEach(function (p) {
var f;
if(cordova_plugins_map[p]){
Expand All @@ -138,7 +143,7 @@ module.exports = function (grunt) {
} else if (command === 'platform'){
options.action = 'add';
tasks.push(function (cb){runPlatform(options,cb);});
} else if (command === 'plugin'){
} else if (command === 'plugin' && options.plugins){
options.action = 'add';
tasks.push(function (cb){runPlugin(options,cb);});
} else if (command === 'prepare' || command === 'compile' || command === 'build'){
Expand Down

0 comments on commit 4248fe4

Please sign in to comment.