diff --git a/README.md b/README.md index ad6c88c..e864dff 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,18 @@ More information about [Apache Cordova Command-line Interface](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface) More information about [Chrome Apps for Mobile](https://github.com/MobileChromeApps/mobile-chrome-apps) -## Getting Started -This plugin requires Grunt `^0.4.5` -NPM module `cordova-cli` or `cca` needs to be install locally or globally +## First Install Cordova or CCA +- This plugin requires Grunt `^0.4.5` +- NPM module `cordova-cli` version >=3.0.0 or `cca` >=0.5.1 needs to be install locally or at peer location as node module grunt-cordovacli, or in a node_module directory of the parent directory structure +```shell +npm install cordova@latest --save +``` +or +```shell +npm install cca@latest --save +``` +## Gettings Started with Grunt and the Cordova/CCA Grunt Plugin If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: ```shell @@ -34,7 +42,7 @@ In your project's Gruntfile, add a section named `cordovacli` to the data object cordovacli: { options: { path: 'myHybridAppFolder' - cli: 'cca' + cli: 'cca' // cca or cordova }, cordova: { options: { diff --git a/package.json b/package.json index e733300..8dee951 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-cordovacli", "description": "Wraps a web application as a hybrid app with Apache Cordova CLI 3.x", - "version": "0.7.1-dev", + "version": "0.7.1", "homepage": "https://github.com/csantanapr/grunt-cordovacli", "author": { "name": "Carlos Santana", diff --git a/tasks/cordovacli.js b/tasks/cordovacli.js index 272af68..c448a21 100644 --- a/tasks/cordovacli.js +++ b/tasks/cordovacli.js @@ -25,7 +25,6 @@ module.exports = function (grunt) { runPlatform, runPlugin, isPlatformExists, - isPluginExists, cordova_path, cordova_json, cordova_pkg, @@ -159,7 +158,7 @@ module.exports = function (grunt) { platform_name = isPlatformExists(p,options.path); if(platform_name){ skip = true; - grunt.log.writeln('Platform '+platform_name+' already exists skipping add'); + grunt.log.writeln('Platform '+platform_name+' already exists skipping add'); } } if(!skip){ @@ -167,30 +166,16 @@ module.exports = function (grunt) { runCordova(['platform', options.action, p ].concat(options.args), {cwd:options.path}, callback); }; tasks.push(f); - } + } }); if ( cordova_cli === 'cca'){ runCordovaSeries(tasks, done); } else { runCordovaParallel(tasks, done); } - - }; - - isPluginExists = function(p, cordovaRootPath) { - var plugin_cdv_dir; - var plugin_id; - // valid platform is like org.apache.cordova.console or org.apache.cordova.console@0.1.0 - plugin_id = p.split('@')[0]; - //let check if plugin already added - plugin_cdv_dir = path.resolve(cordovaRootPath, 'plugins', plugin_id); - if (fs.existsSync(plugin_cdv_dir)) { - return plugin_id; - } else { - return false; - } }; + runPlugin = function (options, done) { //plugin(s) [{add|remove|rm} ] var tasks = []; @@ -207,20 +192,13 @@ module.exports = function (grunt) { if(cordova_plugins_map[p]){ p = cordova_plugins_map[p]; } - if(options.action == 'add'){ - plugin_id = isPluginExists(p,options.path); - if(plugin_id){ - skip = true; - grunt.log.writeln('Plugin '+plugin_id+' already exists skipping add'); - } - } - if(!skip){ - f = function (callback) { - runCordova(['plugin', options.action, p ].concat(options.args), {cwd:options.path}, callback); - }; - tasks.push(f); - } - + + f = function (callback) { + runCordova(['plugin', options.action, p ].concat(options.args), {cwd:options.path}, callback); + }; + tasks.push(f); + + }); runCordovaSeries(tasks, done); };