Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
fixes #82: --no-build option for cordova run etc...
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Grupp committed Feb 18, 2015
1 parent cb8c99a commit 8fcabf9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,14 @@ builds into www and watches version in www. Good for debugging your build!
gulp watch-build
```

#### gulp --cordova 'build|run|emulate|prepare platform'
runs the supplied cordova command, builds your app into www before
```
gulp --cordova 'run|build|emulate|prepare <platform>'
```

#### gulp --cordova
local wrapper for cordova cli (won't use global install to be compatible with generated project)
#### gulp --cordova '<some> <command>'
local wrapper for cordova cli (won't use global install to be compatible with generated project). For instance instead of running `cordova plugins ls` you'd write the following to list all the installed plugins:
```
#arbitrary cordova command
gulp --cordova 'plugin ls'
```
Head over to the [cordova documentation](http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html) to learn how to use the cordova cli. Remember when using generator-m you don't need to install cordova globally!
If you run one of the following cordova commands: `build <platform>`, `run <platform>`, `emulate <platform>`, `prepare <platform>`, then `gulp build` will build your app into the www folder before cordova will take it from there. Sometimes this is not what you want. Simply add the `--no-build` option and `gulp build` will be skipped.

#### gulp config
manage project configuration
Expand All @@ -118,7 +114,7 @@ manage project configuration
1. `yo m:module <moduleName>` - create a new module
2. add your module to the `app/app.js`:

```
```js
'use strict';
angular.module('myProject', [
// your modules
Expand Down
4 changes: 2 additions & 2 deletions app/templates/_gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ gulp.paths = {
// retrieve options
var minimist = require('minimist');
var options = gulp.options = minimist(process.argv.slice(2));
if (options.cordova) {
// gulp build before running cordova?
// gulp build before running cordova?
if (options.cordova && options.build !== false) { // --no-build
var cmds = ['build', 'run', 'emulate', 'prepare'];
for (var i = 0, cmd; (cmd = cmds[i]); i++) {
if (options.cordova.indexOf(cmd) >= 0) {
Expand Down
12 changes: 4 additions & 8 deletions app/templates/gulp_tasks/cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ var options = gulp.options;
// plugins
var $ = require('gulp-load-plugins')();

gulp.task('cordova', function () {
var runCordova = function () {
return gulp.src('')
.pipe($.shell([
'node_modules/cordova/bin/cordova ' + options.cordova
]));
});
};

gulp.task('cordova-with-build', ['build'], function () {
return gulp.src('')
.pipe($.shell([
'node_modules/cordova/bin/cordova ' + options.cordova
]));
});
gulp.task('cordova', runCordova);
gulp.task('cordova-with-build', ['build'], runCordova);

0 comments on commit 8fcabf9

Please sign in to comment.