Skip to content

Commit

Permalink
Tweaking, cleaning, configging.
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonmoeller committed Jul 5, 2015
1 parent 4b949f7 commit 5ff9fbc
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 93 deletions.
8 changes: 5 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"parser": "babel-eslint",

"env": {
"amd": false,
"browser": false,
Expand Down Expand Up @@ -40,7 +42,7 @@
"rules": {
// Possible Errors
"comma-dangle": [2, "never"], // disallow or enforce trailing commas
"no-cond-assign": "except-parens", // disallow assignment in conditional expressions
"no-cond-assign": [2, "except-parens"], // disallow assignment in conditional expressions
"no-console": 0, // disallow use of console (off by default in the node environment)
"no-constant-condition": 2, // disallow use of constant expressions in conditions
"no-control-regex": 2, // disallow control characters in regular expressions
Expand Down Expand Up @@ -131,7 +133,7 @@
"yoda": 0, // require or disallow Yoda conditions

// Strict mode
"strict": "global", // controls location of Use Strict Directives
"strict": [1, "global"], // controls location of Use Strict Directives

// Variables
"no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
Expand Down Expand Up @@ -217,7 +219,7 @@
}],
"space-in-brackets": 0, /* need v1.0 */ // require or disallow spaces inside brackets (off by default)
"space-in-parens": [2, "never"], // require or disallow spaces inside parentheses (off by default)
"space-infix-ops": [2, "always"], // require spaces around operators
"space-infix-ops": 2, // require spaces around operators
"space-return-throw-case": 2, // require a space after return, throw, and case
"space-unary-ops": [1, { // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"words": true,
Expand Down
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
**NOTE: This project is under active development. APIs subject to change.**

# `toga`

[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Build Status][travis-img]][travis-url] [![Chat][gitter-img]][gitter-url]
[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Build Status][travis-img]][travis-url] [![Chat][gitter-img]][gitter-url] [![Tip][amazon-img]][amazon-url]

One tool and one destination for all project documentation including user guides, developer guides, styleguides, and api documentation for both front and back-end technologies. Source code for an entire project is streamed into documentation via [Transform Streams](http://nodejs.org/api/stream.html#stream_class_stream_transform) a la [gulp](http://gulpjs.com/).

Expand Down Expand Up @@ -34,9 +36,9 @@ var toga = require('toga'); // Loads toga.
toga.src(files); // Just `require('vinyl-fs').src`.
toga.dest(directory); // Just `require('vinyl-fs').dest`.

toga.add(...streams); // Turns streams into tributaries of another.
toga.map(callback); // Turns a map function into a transform stream.
toga.merge(...streams); // Merges multiple readable streams into one.
toga.push(...streams); // Pushes objects from a readable stream into a duplex.
toga.merge(...streams); // Turns multiple readable streams into one.
```

## Example `togafile.js`
Expand Down Expand Up @@ -81,18 +83,16 @@ var toga = require('toga'),
pura = require('toga-pura'),

config = {
manual: './src/assets/**/*.md',
css: './src/assets/**/*.css',
js: './src/assets/**/*.js',
manual: [
'./README.md',
'./src/assets/docs/*.md',
],
css: './src/assets/css/*.css',
js: './src/assets/js/*.js',
perl: './lib/**/*.{pl,pm}',
dest: './web/docs'
},

manual = toga
.src(config.manual)
.pipe(md.parser())
.pipe(md.formatter()),

client = toga
.src(config.css)
.pipe(css.parser())
Expand All @@ -106,14 +106,19 @@ var toga = require('toga'),
.pipe(pod.formatter());

toga
.merge(manual, client, server)
.pipe(pura.compiler())
.src(config.manual)
.pipe(md.parser())
.pipe(md.formatter())
.pipe(toga.add(client, server))
.pipe(pura.compiler({
index: './README.md'
}))
.pipe(toga.dest(config.dest));
```

## Contribute

[![Tasks][waffle-img]][waffle-url] [![Tip][gittip-img]][gittip-url]
[![Tasks][waffle-img]][waffle-url]

Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.

Expand All @@ -127,11 +132,13 @@ Standards for this project, including tests, code coverage, and semantics are en

Licensed under [MIT](http://shannonmoeller.com/mit.txt)

[amazon-img]: https://img.shields.io/badge/amazon-tip_jar-yellow.svg?style=flat-square
[amazon-url]: https://www.amazon.com/gp/registry/wishlist/1VQM9ID04YPC5?sort=universal-price
[coveralls-img]: http://img.shields.io/coveralls/togajs/toga-css/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/togajs/toga-css
[downloads-img]: http://img.shields.io/npm/dm/toga.svg?style=flat-square
[gitter-img]: http://img.shields.io/badge/gitter-join_chat-1dce73.svg?style=flat-square
[gitter-url]: https://gitter.im/togajs/toga
[gittip-img]: http://img.shields.io/gittip/shannonmoeller.svg?style=flat-square
[gittip-url]: https://www.gittip.com/shannonmoeller
[npm-img]: http://img.shields.io/npm/v/toga.svg?style=flat-square
[npm-url]: https://npmjs.org/package/toga
[travis-img]: http://img.shields.io/travis/togajs/toga.svg?style=flat-square
Expand Down
46 changes: 27 additions & 19 deletions dist/toga.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
/**
* # Toga
*
* One tool and one destination for all project documentation including user
* guides, developer guides, api documentation, styleguides, and pattern
* libraries for both front and back-end technologies. Source code for an entire
* project is streamed into documentation via [Transform Streams][ts] a la
* [gulp][gulp].
*
* [gulp]: http://gulpjs.com/
* [ts]: http://nodejs.org/api/stream.html#stream_class_stream_transform
*
* @title Toga
* @name toga
*/
Expand Down Expand Up @@ -48,7 +57,6 @@ var Toga = {
* @method dest
* @param {String} dir
* @param {Object=} options
* @param {Function=} callback
* @return {Stream}
*/
dest: _vinylFs.dest,
Expand All @@ -63,37 +71,37 @@ var Toga = {
merge: _mergeStream2['default'],

/**
* Turns a map function into a transform stream.
* Turns streams into tributaries of another.
*
* @method map
* @param {Function(Object):Object} fn
* @method add
* @param {Stream...|Array.<Stream>} streams
* @return {Stream}
*/
map: function map(fn) {
function transform(file, enc, cb) {
fn(file, cb);
add: function add() {
var headwater = _through22['default'].obj();

for (var _len = arguments.length, streams = Array(_len), _key = 0; _key < _len; _key++) {
streams[_key] = arguments[_key];
}

return _through22['default'].obj(transform);
streams.push(headwater);

return _duplexify2['default'].obj(headwater, (0, _mergeStream2['default'])(streams));
},

/**
* Turns streams into tributaries of another.
* Turns a map function into a transform stream.
*
* @method push
* @param {Stream...|Array.<Stream>} streams
* @method map
* @param {Function(Object):Object} fn
* @return {Stream}
*/
push: function push() {
for (var _len = arguments.length, streams = Array(_len), _key = 0; _key < _len; _key++) {
streams[_key] = arguments[_key];
map: function map(fn) {
function transform(file, enc, cb) {
fn(file, cb);
}

var headwater = _through22['default'].obj();

streams.unshift(headwater);

return _duplexify2['default'].obj(headwater, (0, _mergeStream2['default'])(streams));
return _through22['default'].obj(transform);
}
};

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
"url": "https://github.com/togajs/toga.git"
},
"dependencies": {
"duplexify": "^3.4.0",
"duplexify": "^3.4.2",
"find-config": "^0.3.0",
"merge-stream": "^0.1.7",
"through2": "^0.6.5",
"merge-stream": "^0.1.8",
"through2": "^2.0.0",
"vinyl-fs": "^1.0.0",
"yargs": "^3.9.1"
"yargs": "^3.14.0"
},
"devDependencies": {
"babel": "^5.4.7",
"babel-eslint": "^3.1.9",
"babel": "^5.6.14",
"babel-eslint": "^3.1.20",
"babel-istanbul": "^0.2.9",
"coveralls": "^2.11.2",
"eslint": "^0.21.2",
"eslint": "^0.24.0",
"expect": "^1.6.0",
"isparta": "^3.0.3",
"mocha": "^2.2.5",
"mtil": "^0.1.3",
"nodemon": "^1.3.7",
Expand All @@ -48,7 +48,7 @@
"build": "babel src --out-dir dist",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"lint": "eslint src/*.js test/*.js",
"test": "babel-node ./node_modules/.bin/isparta cover --include src/toga.js ./node_modules/.bin/_mocha -- test/*.js",
"test": "babel-istanbul cover -i src/$npm_package_name.js ./node_modules/.bin/_mocha -- test/*.js",
"watch": "nodemon --exec 'npm run test' --watch src --watch test"
}
}
40 changes: 24 additions & 16 deletions src/toga.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
/**
* # Toga
*
* One tool and one destination for all project documentation including user
* guides, developer guides, api documentation, styleguides, and pattern
* libraries for both front and back-end technologies. Source code for an entire
* project is streamed into documentation via [Transform Streams][ts] a la
* [gulp][gulp].
*
* [gulp]: http://gulpjs.com/
* [ts]: http://nodejs.org/api/stream.html#stream_class_stream_transform
*
* @title Toga
* @name toga
*/
Expand Down Expand Up @@ -31,7 +40,6 @@ var Toga = {
* @method dest
* @param {String} dir
* @param {Object=} options
* @param {Function=} callback
* @return {Stream}
*/
dest,
Expand All @@ -45,6 +53,21 @@ var Toga = {
*/
merge,

/**
* Turns streams into tributaries of another.
*
* @method add
* @param {Stream...|Array.<Stream>} streams
* @return {Stream}
*/
add(...streams) {
var headwater = through.obj();

streams.push(headwater);

return duplex.obj(headwater, merge(streams));
},

/**
* Turns a map function into a transform stream.
*
Expand All @@ -58,21 +81,6 @@ var Toga = {
}

return through.obj(transform);
},

/**
* Turns streams into tributaries of another.
*
* @method push
* @param {Stream...|Array.<Stream>} streams
* @return {Stream}
*/
push(...streams) {
var headwater = through.obj();

streams.unshift(headwater);

return duplex.obj(headwater, merge(streams));
}
};

Expand Down

0 comments on commit 5ff9fbc

Please sign in to comment.