Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Commit

Permalink
3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Feb 4, 2014
1 parent fb8b24d commit 7b96b4b
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 47 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# gulp changelog

# 3.5.2

- add -V for version on CLI (unix standard)
- -v is deprecated, use -V
- add -T as an alias for --tasks
- documentation

# 3.5

- added `gulp.watch(globs, tasksArray)` sugar
Expand Down
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ This file is just a quick sample to give you a taste of what gulp does.

```javascript
var gulp = require('gulp');

var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');

var paths = {
scripts: ['client/js/**/*.js', '!client/js/vendor/**'],
scripts: ['client/js/**/*.coffee', '!client/external/**/*.coffee'],
images: 'client/img/**/*'
};

gulp.task('scripts', function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(coffee())
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('build/js'));
});

Expand All @@ -58,23 +63,6 @@ gulp.task('default', ['scripts', 'images', 'watch']);
```


## gulp CLI

### Tasks

Tasks can be executed by running `gulp <task> <othertask>`. Just running `gulp` will execute the task you registered called `default`. If there is no `default` task gulp will error.

### Compilers

You can use any language you want for your gulpfile. You will have to specify the language module name so the CLI can load it (and its associated extensions) before attempting to find your gulpfile. Make sure you have this module installed accessible by the folder you are running the CLI in.

Example:

```
gulp dosomething --require coffee-script/register
```


[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/wearefractal/gulp/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[npm-url]: https://npmjs.org/package/gulp
Expand Down
38 changes: 23 additions & 15 deletions bin/gulp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,37 @@

var path = require('path');

var parseArgs = require('minimist');
var argv = parseArgs(process.argv.slice(2));
var completion = require('../lib/completion');
var resolve = require('resolve');
var findup = require('findup-sync');
var gutil = require('gulp-util');
var prettyTime = require('pretty-hrtime');
var minimist = require('minimist');
var semver = require('semver');
var archy = require('archy');

var completion = require('../lib/completion');
var taskTree = require('../lib/taskTree');
var cliPkg = require('../package.json');

// parse what we want off the CLI
var argv = minimist(process.argv.slice(2));

if (argv.completion) {
return completion(argv.completion);
}

var resolve = require('resolve');
var findup = require('findup-sync');
var gutil = require('gulp-util');
var prettyTime = require('pretty-hrtime');

var tasks = argv._;
var cliPkg = require('../package.json');
var tasksFlag = argv.T || argv.tasks;

// TODO: drop argv.v in the next breaking release
var versionFlag = argv.v || argv.V || argv.version;
var cwdFlag = argv.cwd;
var fileFlag = argv.gulpfile;

var cwd;

if (argv.cwd) {
cwd = path.resolve(argv.cwd);
if (cwdFlag) {
cwd = path.resolve(cwdFlag);
} else {
cwd = process.cwd();
}
Expand All @@ -35,8 +43,8 @@ loadRequires(argv.require, cwd);

var gulpFile;

if (argv.gulpfile) {
gulpFile = path.join(cwd, argv.gulpfile);
if (fileFlag) {
gulpFile = path.join(cwd, fileFlag);
} else {
gulpFile = getGulpFile(cwd);
}
Expand All @@ -46,7 +54,7 @@ var localGulp = findLocalGulp(gulpFile);
var localPkg = findLocalGulpPackage(gulpFile);

// print some versions and shit
if (argv.V || argv.version) {
if (versionFlag) {
gutil.log('CLI version', cliPkg.version);
if (localGulp) {
gutil.log('Local version', localPkg.version);
Expand Down Expand Up @@ -127,7 +135,7 @@ function loadGulpFile(localGulp, gulpFile, tasks){

// just for good measure
process.nextTick(function(){
if (argv.tasks) {
if (tasksFlag) {
return logTasks(gulpFile, localGulp);
}

Expand Down
25 changes: 25 additions & 0 deletions docs/CLI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## gulp CLI docs

### Flags

gulp has very few flags to know about. All other flags are for tasks to use if needed.

- `-V` or `--version` will display the global and local gulp versions
- `--require <module path>` will require a module before running the gulpfile. This is useful for transpilers but also has other applications. You can use multiple `--require` flags
- `--gulpfile <gulpfile path>` manually set path of gulpfile. Useful if you have multiple gulpfiles. This will set the CWD to the gulpfile directory as well.
- `--cwd <dir path>` manually set the CWD. The search for the gulpfile, as well as the relativity of all requires will be from here.
- `-T` or `--tasks` will display the task dependency tree for the loaded gulpfile

### Tasks

Tasks can be executed by running `gulp <task> <othertask>`. Just running `gulp` will execute the task you registered called `default`. If there is no `default` task gulp will error.

### Compilers

You can use any language you want for your gulpfile. You will have to specify the language module name so the CLI can load it (and its associated extensions) before attempting to find your gulpfile. Make sure you have this module installed accessible by the folder you are running the CLI in.

Example:

```
gulp dosomething --require coffee-script/register
```
22 changes: 9 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@

* [Getting Started](getting-started.md) - How to get going with gulp
* [API documentation](API.md) - Learn the ins and outs of using gulp
* [CLI documentation](CLI.md) - Learn how to call tasks and use compilers
* [Writing a Plugin](writing-a-plugin/README.md) - So you're writing a gulp plugin? Go here for the essential dos and don'ts.

## FAQ

See [the FAQ](FAQ.md) for the answers to commonly asked questions.

## Articles and Recipes
## Recipes

* [Getting started with gulp (by @markgdyr)](http://markgoodyear.com/2014/01/getting-started-with-gulp/)
* [Why you shouldn’t create a gulp plugin (or, how to stop worrying and learn to love existing node packages)](http://blog.overzealous.com/post/74121048393/why-you-shouldnt-create-a-gulp-plugin-or-how-to-stop)
* [Working with multiple sources in one task](recipes/using-multiple-sources-in-one-task.md)
* [Mocha test runner with gulp](recipes/mocha-test-runner-with-gulp.md)
* [Rebuild only files that change](recipes/rebuild-only-files-that-change.md)
* [Pass parameters from the command line](recipes/pass-params-from-cli.md)
* [Using external config file](recipes/using-external-config-file.md)
* [Running tasks in series](recipes/running-tasks-in-series.md)
* [Introduction to node.js streams](https://github.com/substack/stream-handbook)
* [Video introduction to node.js streams](http://www.youtube.com/watch?v=QgEuZ52OZtU)
The community has compiled guides on how to use gulp for common use cases. Check out the [recipes folder](recipes) for a full list.

## Presentations and slides
## Articles

* [Inspiration (slides)](http://slid.es/contra/gulp)
* [Introduction to node.js streams](https://github.com/substack/stream-handbook)
* [Video introduction to node.js streams](http://www.youtube.com/watch?v=QgEuZ52OZtU)
* [Getting started with gulp (by @markgdyr)](http://markgoodyear.com/2014/01/getting-started-with-gulp/)
* [Why you shouldn’t create a gulp plugin (or, how to stop worrying and learn to love existing node packages)](http://blog.overzealous.com/post/74121048393/why-you-shouldnt-create-a-gulp-plugin-or-how-to-stop)
* [Inspiration (slides) about why gulp was made](http://slid.es/contra/gulp)

## License

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gulp",
"description": "The streaming build system",
"version": "3.5.1",
"version": "3.5.2",
"homepage": "http://github.com/wearefractal/gulp",
"repository": "git://github.com/wearefractal/gulp.git",
"author": "Fractal <[email protected]> (http://wearefractal.com/)",
Expand Down

0 comments on commit 7b96b4b

Please sign in to comment.