<commit_before><div align="center">
  <a href="http://github.com/flyjs/fly">
    <img width=100px  src="https://cloud.githubusercontent.com/assets/8317250/8733685/0be81080-2c40-11e5-98d2-c634f076ccd7.png">
  </a>
</div>


<p align="center">
<b><a href="#features">Features</a></b>
|
<b><a href="#flyfiles">Flyfiles</a></b>
|
<b><a href="#cli">CLI</a></b>
|
<b><a href="#api">API</a></b>
|
<b><a href="#plugins">Plugins</a></b>
|
<b><a href="#hacking">Hacking</a></b>
|
<b><a href="README.ja.md">日本語</a></b>


# Documentation
_Fly_ is a task automation tool, very much in the same vein of [Gulp](http://gulpjs.com/), [Grunt](http://gruntjs.com/), [etc](https://gist.github.com/callumacrae/9231589).

_Fly_ is written from the ground up to take advantage of generators and promises.

Similar to Gulp, _Fly_ favors _code_ over configuration.

## Features

> Fly requires [generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) and [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) support, i.e, `iojs` / `node >= 0.11`.

* Fly shuns the [stream](https://nodejs.org/api/stream.html)-based implementation common in other build systems and favors promises and generator based flow-control via [co-routines](https://github.com/tj/co).

* Fly is itself written in pure EcmaScript5, which makes it very lightweight and quick. You won't have to install a thousand sub-dependencies and tasks will complete faster than their Gulp or Grunt equivalents. 

+ By default, Tasks are described using [generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) functions and so the asynchronous flow is controlled with [`yield`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield):

  ```js
  module.exports.default = function * () {
    yield this.source("index.js").uglify().target("dist")
  }
  ```

+ Fly allows tasks to cascade results. A task's return value is the argument of the next task in a running sequence.

  ```js
  var x = module.exports
  
  x.default = function * () {
    yield this.start(["first", "second"])
  }

  x.first = function * () {
    return { secret: 42 }
  }

  x.second = function * ({ secret }) {
    this.log(`The secret is ${secret}`)
  }
  ```

+ Fly API allows you to compose tasks similar to a pipeline, but it's not limited to the stream metaphor.

  ```js
  module.exports.default = function * () {
    yield this
      .source("src/**/*.js")
      .eslint()
      .uglify()
      .concat("all.min.js")
      .target("dist")
  }
  ```

+ Fly supports concurrent tasks via `Fly.prototype.start([tasks], { parallel: true })`:

  ```js
  module.exports.default = function * () {
    yield this.start(["task1", "task2", "task3"], { parallel: true })
  }
  ```

+ Use `Fly.prototype.filter(Function)` to add a transform in the sequence. If your function is async wrap it with `Fly.prototype.defer`.

+ Plugins are automatically loaded -- just include it in your `package.json` and under `node_modules`.

+ Use JSDoc's `/** @desc description */` to describe tasks. The text is displayed when listing tasks on the terminal with `fly -l`.

  ```js
  module.exports.task = function * () {
    /** @desc This is the task description. */
  }
  ```

## _Flyfiles_

Similar to other build systems, _Fly_ reads a `flyfile.js` (case sensitive) to run your tasks.

<!-- > ES6/7 is supported out of the box. Other JavaScript variants require the corresponding module to transpile them on the _fly_. -->

### Examples

A Flyfile exports its tasks as generator functions:

```js
exports.default = function* () {
  yield this.source("*")...target("./")
}
```

<!-- _ES6_:
```js
export default function* () {
  yield this.source("*")...target("./")
}
```

_ES7_:
```js
export default async function () {
  await this.source("*")...target("./")
}
```
-->

See inside `examples/` for a large collection Flyfile samples.

## CLI

You can access the CLI via `fly [options] [tasks]` in your terminal after installing Fly:

```
fly task1 task2 ...
```

Fly supports the following flags:

#### `-h  --help`

Display the help.

#### `-f  --file` `<path>`

Use an alternate Flyfile.

```
fly -f examples/
```

Or

```
fly -f path/to/another/Flyfile.js
```
<commit_msg>add flyfile examples<commit_after><div align="center">
  <a href="http://github.com/flyjs/fly">
    <img width=100px  src="https://cloud.githubusercontent.com/assets/8317250/8733685/0be81080-2c40-11e5-98d2-c634f076ccd7.png">
  </a>
</div>


<p align="center">
<b><a href="#features">Features</a></b>
|
<b><a href="#flyfiles">Flyfiles</a></b>
|
<b><a href="#cli">CLI</a></b>
|
<b><a href="#api">API</a></b>
|
<b><a href="#plugins">Plugins</a></b>
|
<b><a href="#hacking">Hacking</a></b>
|
<b><a href="README.ja.md">日本語</a></b>


# Documentation
_Fly_ is a task automation tool, very much in the same vein of [Gulp](http://gulpjs.com/), [Grunt](http://gruntjs.com/), [etc](https://gist.github.com/callumacrae/9231589).

_Fly_ is written from the ground up to take advantage of generators and promises.

Similar to Gulp, _Fly_ favors _code_ over configuration.

## Features

> Fly requires [generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) and [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) support, i.e, `iojs` / `node >= 0.11`.

* Fly shuns the [stream](https://nodejs.org/api/stream.html)-based implementation common in other build systems and favors promises and generator based flow-control via [co-routines](https://github.com/tj/co).

* Fly is itself written in pure EcmaScript5, which makes it very lightweight and quick. You won't have to install a thousand sub-dependencies and tasks will complete faster than their Gulp or Grunt equivalents. 

+ By default, Tasks are described using [generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) functions and so the asynchronous flow is controlled with [`yield`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield):

  ```js
  module.exports.default = function * () {
    yield this.source("index.js").uglify().target("dist")
  }
  ```

+ Fly allows tasks to cascade results. A task's return value is the argument of the next task in a running sequence.

  ```js
  var x = module.exports
  
  x.default = function * () {
    yield this.start(["first", "second"])
  }

  x.first = function * () {
    return { secret: 42 }
  }

  x.second = function * ({ secret }) {
    this.log(`The secret is ${secret}`)
  }
  ```

+ Fly API allows you to compose tasks similar to a pipeline, but it's not limited to the stream metaphor.

  ```js
  module.exports.default = function * () {
    yield this
      .source("src/**/*.js")
      .eslint()
      .uglify()
      .concat("all.min.js")
      .target("dist")
  }
  ```

+ Fly supports concurrent tasks via `Fly.prototype.start([tasks], { parallel: true })`:

  ```js
  module.exports.default = function * () {
    yield this.start(["task1", "task2", "task3"], { parallel: true })
  }
  ```

+ Use `Fly.prototype.filter(Function)` to add a transform in the sequence. If your function is async wrap it with `Fly.prototype.defer`.

+ Plugins are automatically loaded -- just include it in your `package.json` and under `node_modules`.

+ Use JSDoc's `/** @desc description */` to describe tasks. The text is displayed when listing tasks on the terminal with `fly -l`.

  ```js
  module.exports.task = function * () {
    /** @desc This is the task description. */
  }
  ```

## _Flyfiles_

Similar to other build systems, _Fly_ reads a `flyfile.js` (case sensitive) to run your tasks.

<!-- > ES6/7 is supported out of the box. Other JavaScript variants require the corresponding module to transpile them on the _fly_. -->

### Examples

A Flyfile exports its tasks as generator functions:

```js
module.exports.default = function * () {
  yield this.source("*")...target("./")
}
```

When declaring multiple tasks (as is often the case), it is recommended that you store the `module.exports` as a simple variable to avoid repetitive boilerplate:

```js
var x = module.exports

x.default = function * () {
  yield this.start('styles', 'scripts')
}

x.styles = function * () {
  yield this.source('src/styles/*.css')
    // ...
    .concat('main.css')
    .target('dist/css')
}

x.scripts = function * () {
  yield this.source('src/scripts/*.js')
    .eslint()
    // ...
    .concat('main.js')
    .target('dist/js')
}
```

It is also recommended to declare a `paths` object to easily maintain and configure your application tasks' relevant directories.

```js
var x = module.exports
var paths = {
  css: {
    src: 'src/styles/*.css',
    dist: 'dist/css'
  },
  js: {
    src: 'src/scripts/*.js',
    dist: 'dist/js'
  }
}

x.default = function * () {
  yield this.start('styles', 'scripts')
}

x.styles = function * () {
  yield this.source(paths.css.src)
    // ...
    .concat('main.css')
    .target(paths.css.dist)
}

x.scripts = function * () {
  yield this.source(paths.js.src)
    .eslint()
    // ...
    .concat('main.js')
    .target(paths.js.dist)
}
```

> This also means that you can separate your pathing configuration from your task definitions. Then you can `require()` your `paths` object into your flyfile. 

<!-- _ES6_:
```js
export default function* () {
  yield this.source("*")...target("./")
}
```

_ES7_:
```js
export default async function () {
  await this.source("*")...target("./")
}
```
-->

Browse the `examples/` folder for additional Flyfile samples.

## CLI

You can access the CLI via `fly [options] [tasks]` in your terminal after installing Fly:

```
fly task1 task2 ...
```

Fly supports the following flags:

#### `-h  --help`

Display the help.

#### `-f  --file` `<path>`

Use an alternate Flyfile.

```
fly -f examples/
```

Or

```
fly -f path/to/another/Flyfile.js
```

{'fraction_non_alphanumeric': 0.16791529317750475, 'fraction_numerical': 0.012186594745779643, 'mean_word_length': 3.5675182481751824, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 84, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2679089', 'n_tokens_mistral': 3440, 'n_tokens_neox': 3214, 'n_words': 953}