Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v2.0.7. Improvement.

- v2.0.7 December 12, 2013
	-  Use native streams if available, otherwise fallback to
[readable-stream](https://npmjs.org/package/readable-stream)
	- Repackaged
  • Loading branch information...
commit 471836644cd65b5a1a0ef7284cf38b01cbae2d2b 1 parent a2313e7
@balupton balupton authored
View
29 .gitignore
@@ -1,17 +1,18 @@
-lib-cov
-*.seed
-*.log
-*.csv
-*.dat
-*.out
-*.pid
-*.gz
+# v1.3.10 December 10, 2013
+# https://github.com/bevry/base
-pids
-logs
-results
+# Temp Files
+**/*.log
+**/.docpad.db
-node_modules
-npm-debug.log
+# Build Files
+build/
+components/
+bower_components/
+node_modules/
+out/
-out/
+# =====================================
+# CUSTOM MODIFICATIONS
+
+# None
View
33 .npmignore
@@ -1,9 +1,32 @@
+# v1.3.10 December 10, 2013
+# https://github.com/bevry/base
+
+# Temp Files
+**/*.log
+**/.docpad.db
+
+# Build Files
+build/
+components/
+bower_components/
+node_modules/
+
+# Development Files
.travis*
Cakefile
Makefile
-History.md
+BACKERS.md
+CONTRIBUTING.md
+HISTORY.md
+**/src/
+**/test/
+
+# Other Package Definitions
+template.js
+component.json
+bower.json
+
+# =====================================
+# CUSTOM MODIFICATIONS
-src/
-out/test/
-test/
-media/
+# None
View
8 .travis.yml
@@ -1,6 +1,8 @@
+# v1.3.8 November 7, 2013
+# https://github.com/bevry/base
language: node_js
-install: "npm install"
-before_script: "./node_modules/.bin/cake test-prepare"
+install: "npm install; ./node_modules/.bin/cake install"
+before_script: "./node_modules/.bin/cake compile"
script: "npm test"
node_js:
- "0.8"
@@ -10,4 +12,4 @@ notifications:
- "irc.freenode.org#bevry-dev"
email:
recipients:
- - travisci@bevry.me
+ - travisci@bevry.me
View
82 CONTRIBUTING.md
@@ -0,0 +1,82 @@
+<!--
+v1.3.10 December 10, 2013
+https://github.com/bevry/base
+-->
+
+
+# Contribute
+
+
+## Resources
+
+- [Coding Standards](http://bevry.me/bevry/coding-standards)
+- [Documentation Guidelines](http://bevry.me/bevry/documentation-guidelines)
+- [Support Guidelines](http://bevry.me/bevry/support-guidelines)
+
+
+## Development
+
+For developers and contributors
+
+1. Fork project and clone your fork
+
+2. Install global dependencies
+
+ ``` bash
+ npm install -g coffee-script
+ ```
+
+3. Install local dependencies
+
+ ``` bash
+ cake install
+ ```
+
+4. Compile project
+
+ ``` bash
+ # Only once
+ cake compile
+
+ # On every change
+ cake watch
+ ```
+
+5. Run tests
+
+ ``` bash
+ cake test
+ ```
+
+
+## Publishing
+
+For project maintainers
+
+1. Update meta files with latest information
+
+ ``` bash
+ cake prepublish
+ ```
+
+2. Add a changelog entry to `HISTORY.md` with change information
+
+ ```
+ v2.0.0 April 17, 2013
+ - Something that changes
+ ```
+
+3. Update `version` entry in `package.json` with new version number
+
+4. Commit changes
+
+ ``` bash
+ git commit -a -m "A message about what changed"
+ ```
+
+5. Publish new version
+
+ ``` bash
+ cake publish
+ ```
+
View
326 Cakefile
@@ -1,122 +1,242 @@
-# This file was originally created by Benjamin Lupton <b@lupton.cc> (http://balupton.com)
-# and is currently licensed under the Creative Commons Zero (http://creativecommons.org/publicdomain/zero/1.0/)
-# making it public domain so you can do whatever you wish with it without worry (you can even remove this notice!)
-#
-# If you change something here, be sure to reflect the changes in:
-# - the scripts section of the package.json file
-# - the .travis.yml file
+# v1.3.11 December 11, 2013
+# https://github.com/bevry/base
-# -----------------
-# Variables
+# =====================================
+# Imports
-WINDOWS = process.platform.indexOf('win') is 0
-NODE = process.execPath
-NPM = if WINDOWS then process.execPath.replace('node.exe','npm.cmd') else 'npm'
-EXT = (if WINDOWS then '.cmd' else '')
-APP = process.cwd()
-BIN = "#{APP}/node_modules/.bin"
-CAKE = "#{BIN}/cake#{EXT}"
-COFFEE = "#{BIN}/coffee#{EXT}"
-OUT = "#{APP}/out"
-SRC = "#{APP}/src"
+fsUtil = require('fs')
+pathUtil = require('path')
-# -----------------
-# Requires
+# =====================================
+# Variables
-pathUtil = require('path')
-{exec,spawn} = require('child_process')
+WINDOWS = process.platform.indexOf('win') is 0
+NODE = process.execPath
+NPM = (if WINDOWS then process.execPath.replace('node.exe', 'npm.cmd') else 'npm')
+EXT = (if WINDOWS then '.cmd' else '')
+GIT = "git"
+
+APP_PATH = process.cwd()
+PACKAGE_PATH = pathUtil.join(APP_PATH, "package.json")
+PACKAGE_DATA = require(PACKAGE_PATH)
+
+MODULES_PATH = pathUtil.join(APP_PATH, "node_modules")
+DOCPAD_PATH = pathUtil.join(MODULES_PATH, "docpad")
+BIN_PATH = pathUtil.join(MODULES_PATH, ".bin")
+CAKE = pathUtil.join(BIN_PATH, "cake" + EXT)
+COFFEE = pathUtil.join(BIN_PATH, "coffee" + EXT)
+PROJECTZ = pathUtil.join(BIN_PATH, "projectz" + EXT)
+DOCCO = pathUtil.join(BIN_PATH, "docco" + EXT)
+DOCPAD = pathUtil.join(BIN_PATH, "docpad" + EXT)
+
+config = {}
+config.TEST_PATH = "test"
+config.DOCCO_SRC_PATH = null
+config.DOCCO_OUT_PATH = "docs"
+config.COFFEE_SRC_PATH = "src" # eventually we'll set this to null, right now it isn't for b/c compat
+config.COFFEE_OUT_PATH = "out"
+config.DOCPAD_SRC_PATH = null
+config.DOCPAD_OUT_PATH = "out"
+
+for own key,value of (PACKAGE_DATA.cakeConfiguration or {})
+ config[key] = value
+
+for own key,value of config
+ config[key] = pathUtil.resolve(APP_PATH, value) if value
+
+
+# =====================================
+# Generic
+
+{spawn, exec} = require('child_process')
safe = (next,fn) ->
+ fn ?= next # support only one argument
return (err) ->
- return next(err) if err
- return fn()
+ # success status code
+ if err is 0
+ err = null
+ # error status code
+ else if err is 1
+ err = new Error('Process exited with error status code')
-# -----------------
-# Actions
+ # Error
+ return next(err) if err
-clean = (opts,next) ->
- (next = opts; opts = {}) unless next?
- args = [
- '-Rf'
- OUT
- pathUtil.join(APP,'node_modules')
- pathUtil.join(APP,'*out')
- pathUtil.join(APP,'*log')
- ]
- spawn('rm', args, {stdio:'inherit',cwd:APP}).on('exit',next)
-
-compile = (opts,next) ->
- (next = opts; opts = {}) unless next?
- spawn(COFFEE, ['-bco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)
-
-watch = (opts,next) ->
- (next = opts; opts = {}) unless next?
- spawn(COFFEE, ['-bwco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)
-
-install = (opts,next) ->
- (next = opts; opts = {}) unless next?
- spawn(NPM, ['install'], {stdio:'inherit',cwd:APP}).on('exit',next)
-
-reset = (opts,next) ->
- (next = opts; opts = {}) unless next?
- clean opts, safe next, ->
- install opts, safe next, ->
- compile opts, next
-
-setup = (opts,next) ->
- (next = opts; opts = {}) unless next?
- install opts, safe next, ->
- compile opts, next
-
-test = (opts,next) ->
- (next = opts; opts = {}) unless next?
- spawn(NPM, ['test'], {stdio:'inherit',cwd:APP}).on('exit',next)
+ # Continue
+ return fn()
finish = (err) ->
throw err if err
console.log('OK')
-# -----------------
-# Commands
-
-# clean
-task 'clean', 'clean up instance', ->
- clean finish
-
-# compile
-task 'compile', 'compile our files', ->
- compile finish
-
-# dev/watch
-task 'dev', 'watch and recompile our files', ->
- watch finish
-task 'watch', 'watch and recompile our files', ->
- watch finish
-
-# install
-task 'install', 'install dependencies', ->
- install finish
-
-# reset
-task 'reset', 'reset instance', ->
- reset finish
-
-# setup
-task 'setup', 'setup for development', ->
- setup finish
-
-# test
-task 'test', 'run our tests', ->
- test finish
-
-# test-debug
-task 'test-debug', 'run our tests in debug mode', ->
- test {debug:true}, finish
+# =====================================
+# Actions
-# test-prepare
-task 'test-prepare', 'prepare out tests', ->
- setup finish
+actions =
+ clean: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+ args = ['-Rf', config.COFFEE_COFFEE_OUT_PATH]
+ for path in [APP_PATH, config.TEST_PATH]
+ args.push(
+ pathUtil.join(path, 'build')
+ pathUtil.join(path, 'components')
+ pathUtil.join(path, 'bower_components')
+ pathUtil.join(path, 'node_modules')
+ pathUtil.join(path, '*out')
+ pathUtil.join(path, '*log')
+ )
+
+ # rm
+ console.log('clean')
+ spawn('rm', args, {stdio:'inherit', cwd:APP_PATH}).on('close', safe next)
+
+ install: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('npm install (for app)')
+ spawn(NPM, ['install'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step2)
+ step2 = ->
+ return step3() if !config.TEST_PATH or !fsUtil.existsSync(config.TEST_PATH)
+ console.log('npm install (for test)')
+ spawn(NPM, ['install'], {stdio:'inherit', cwd:config.TEST_PATH}).on('close', safe next, step3)
+ step3 = ->
+ return step4() if !fsUtil.existsSync(DOCPAD_PATH)
+ console.log('npm install (for docpad tests)')
+ spawn(NPM, ['install'], {stdio:'inherit', cwd:DOCPAD_PATH}).on('close', safe next, step4)
+ step4 = next
+
+ # Start
+ step1()
+
+ compile: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('cake install')
+ actions.install(opts, safe next, step2)
+ step2 = ->
+ return step3() if !config.COFFEE_SRC_PATH or !fsUtil.existsSync(COFFEE)
+ console.log('coffee compile')
+ spawn(COFFEE, ['-co', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3)
+ step3 = ->
+ return step4() if !config.DOCPAD_SRC_PATH or !fsUtil.existsSync(DOCPAD)
+ console.log('docpad generate')
+ spawn(DOCPAD, ['generate'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step4)
+ step4 = next
+
+ # Start
+ step1()
+
+ watch: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('cake install')
+ actions.install(opts, safe next, step2)
+ step2 = ->
+ return step3() if !config.COFFEE_SRC_PATH or !fsUtil.existsSync(COFFEE)
+ console.log('coffee watch')
+ spawn(COFFEE, ['-wco', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3)
+ step3 = ->
+ return step4() if !config.DOCPAD_SRC_PATH or !fsUtil.existsSync(DOCPAD)
+ console.log('docpad run')
+ spawn(DOCPAD, ['run'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step4)
+ step4 = next
+
+ # Start
+ step1()
+
+ test: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('cake compile')
+ actions.compile(opts, safe next, step2)
+ step2 = ->
+ console.log('npm test')
+ spawn(NPM, ['test'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3)
+ step3 = next
+
+ # Start
+ step1()
+
+ prepublish: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('cake compile')
+ actions.compile(opts, safe next, step2)
+ step2 = ->
+ return step3() if !fsUtil.existsSync(PROJECTZ)
+ console.log('projectz compile')
+ spawn(PROJECTZ, ['compile'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3)
+ step3 = ->
+ return step4() if !config.DOCCO_SRC_PATH or !fsUtil.existsSync(DOCCO)
+ console.log('docco compile')
+ exec("#{DOCCO} -o #{config.DOCCO_OUT_PATH} #{config.DOCCO_SRC_PATH}", {stdio:'inherit', cwd:APP_PATH}, safe next, step4)
+ step4 = ->
+ console.log('cake test')
+ actions.test(opts, safe next, step5)
+ step5 = next
+
+ # Start
+ step1()
+
+ publish: (opts,next) ->
+ # Prepare
+ (next = opts; opts = {}) unless next?
+
+ # Steps
+ step1 = ->
+ console.log('cake prepublish')
+ actions.prepublish(opts, safe next, step2)
+ step2 = ->
+ console.log('npm publish')
+ spawn(NPM, ['publish'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3)
+ step3 = ->
+ console.log('git tag')
+ spawn(GIT, ['tag', 'v'+PACKAGE_DATA.version, '-a'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step4)
+ step4 = ->
+ console.log('git push origin master')
+ spawn(GIT, ['push', 'origin', 'master'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step5)
+ step5 = ->
+ console.log('git push tags')
+ spawn(GIT, ['push', 'origin', '--tags'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step6)
+ step6 = next
+
+ # Start
+ step1()
+
+
+# =====================================
+# Commands
+commands =
+ clean: 'clean up instance'
+ install: 'install dependencies'
+ compile: 'compile our files (runs install)'
+ watch: 'compile our files initially, and again for each change (runs install)'
+ test: 'run our tests (runs compile)'
+ prepublish: 'prepare our package for publishing'
+ publish: 'publish our package (runs prepublish)'
+
+Object.keys(commands).forEach (key) ->
+ description = commands[key]
+ fn = actions[key]
+ task key, description, (opts) -> fn(opts, finish)
View
6 History.md
@@ -1,4 +1,8 @@
-## History
+# History
+
+- v2.0.7 December 12, 2013
+ - Use native streams if available, otherwise fallback to [readable-stream](https://npmjs.org/package/readable-stream)
+ - Repackaged
- v2.0.6 October 23, 2013
- `Logger:log` is now permantely bound to the logger instance, for easy passing around
View
53 README.md
@@ -9,10 +9,10 @@
<!-- BADGES/ -->
[![Build Status](http://img.shields.io/travis-ci/bevry/caterpillar.png?branch=master)](http://travis-ci.org/bevry/caterpillar "Check this project's build status on TravisCI")
-[![NPM version](https://badge.fury.io/js/caterpillar.png)](https://npmjs.org/package/caterpillar "View this project on NPM")
+[![NPM version](http://badge.fury.io/js/caterpillar.png)](https://npmjs.org/package/caterpillar "View this project on NPM")
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
-[![Flattr donate button](https://raw.github.com/balupton/flattr-buttons/master/badge-89x18.gif)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
-[![PayPayl donate button](https://www.paypalobjects.com/en_AU/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
+[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
+[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
<!-- /BADGES -->
@@ -24,10 +24,15 @@ Caterpillar is the ultimate logging system for Node.js, based on [transform stre
## Install
-### [Node](http://nodejs.org/), [Browserify](http://browserify.org/)
+### [Node](http://nodejs.org/)
- Use: `require('caterpillar')`
- Install: `npm install --save caterpillar`
+### [Browserify](http://browserify.org/)
+- Use: `require('caterpillar')`
+- Install: `npm install --save caterpillar`
+- CDN URL: `//wzrd.in/bundle/caterpillar@2.0.7`
+
### [Ender](http://ender.jit.su/)
- Use: `require('caterpillar')`
- Install: `ender add caterpillar`
@@ -41,17 +46,27 @@ Caterpillar is the ultimate logging system for Node.js, based on [transform stre
``` javascript
// Import
-var level = process.argv.indexOf('-d') === -1 ? 6 : 7;
-var logger = require('caterpillar').createLogger({level:level});
-var filter = require('caterpillar-filter').createFilter();
-var human = require('caterpillar-human').createHuman();
-
-// Pipe logger output to filter, then filter output to stdout
-logger.pipe(filter).pipe(human).pipe(process.stdout);
-
-// If we are debugging, then write the original logger data to debug.log
-if ( level === 7 ) {
- logger.pipe(require('fs').createWriteStream('./debug.log'));
+var level = process.argv.indexOf('-d') === -1 ? 6 : 7;
+var logger = require('caterpillar').createLogger({level:level});
+var filter = require('caterpillar-filter').createFilter();
+var human = require('caterpillar-human').createHuman();
+var browser = require('caterpillar-browser').createBrowser();
+
+// Where to output?
+if ( process.title === 'browser' ) {
+ // Pipe the filter to human to console.log
+ logger.pipe(filter).pipe(human).on('data', function(message){
+ console.log(message.toString());
+ });
+}
+else {
+ // Pipe the filter to human to stdout
+ logger.pipe(filter).pipe(human).pipe(process.stdout);
+
+ // If we are debugging, then write the original logger data to debug.log
+ if ( level === 7 ) {
+ logger.pipe(require('fs').createWriteStream('./debug.log'));
+ }
}
// Log messages
@@ -167,7 +182,7 @@ new (require('caterpillar').Logger)(config)
<!-- HISTORY/ -->
## History
-[Discover the change history by heading on over to the `History.md` file.](https://github.com/bevry/caterpillar/blob/master/History.md#files)
+[Discover the change history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/caterpillar/blob/master/HISTORY.md#files)
<!-- /HISTORY -->
@@ -187,8 +202,8 @@ These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
-[![Flattr donate button](https://raw.github.com/balupton/flattr-buttons/master/badge-89x18.gif)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
-[![PayPayl donate button](https://www.paypalobjects.com/en_AU/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
+[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
+[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
### Contributors
@@ -197,7 +212,7 @@ These amazing people have contributed code to this project:
- Benjamin Lupton <b@lupton.cc> (https://github.com/balupton) - [view contributions](https://github.com/bevry/caterpillar/commits?author=balupton)
- t-visualappeal (https://github.com/t-visualappeal) - [view contributions](https://github.com/bevry/caterpillar/commits?author=t-visualappeal)
-[Become a contributor!](https://github.com/bevry/caterpillar/blob/master/Contributing.md#files)
+[Become a contributor!](https://github.com/bevry/caterpillar/blob/master/CONTRIBUTING.md#files)
<!-- /BACKERS -->
View
9 example-browser.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Caterpillar Tests</title>
+</head>
+<body>
+ <script src="./example-browser.js"></script>
+</body>
+</html>
View
5,974 example-browser.js
5,974 additions, 0 deletions not shown
View
28 example.js
@@ -1,15 +1,25 @@
// Import
-var level = process.argv.indexOf('-d') === -1 ? 6 : 7;
-var logger = require('./').createLogger({level:level});
-var filter = require('caterpillar-filter').createFilter();
-var human = require('caterpillar-human').createHuman();
+var level = process.argv.indexOf('-d') === -1 ? 6 : 7;
+var logger = require('caterpillar').createLogger({level:level});
+var filter = require('caterpillar-filter').createFilter();
+var human = require('caterpillar-human').createHuman();
+var browser = require('caterpillar-browser').createBrowser();
-// Pipe logger output to filter, then filter output to stdout
-logger.pipe(filter).pipe(human).pipe(process.stdout);
+// Where to output?
+if ( process.title === 'browser' ) {
+ // Pipe the filter to human to console.log
+ logger.pipe(filter).pipe(human).on('data', function(message){
+ console.log(message.toString());
+ });
+}
+else {
+ // Pipe the filter to human to stdout
+ logger.pipe(filter).pipe(human).pipe(process.stdout);
-// If we are debugging, then write the original logger data to debug.log
-if ( level === 7 ) {
- logger.pipe(require('fs').createWriteStream('./debug.log'));
+ // If we are debugging, then write the original logger data to debug.log
+ if ( level === 7 ) {
+ logger.pipe(require('fs').createWriteStream('./debug.log'));
+ }
}
// Log messages
View
35 package.json
@@ -1,9 +1,19 @@
{
"title": "Caterpillar",
"name": "caterpillar",
- "version": "2.0.6",
+ "version": "2.0.7",
"description": "Caterpillar is the ultimate logging system for Node.js, based on transform streams you can log to it and pipe the output off to different locations, including some pre-made ones. Caterpillar also supports log levels according to the RFC standard, as well as line, method, and file fetching for messages. You can even use it in web browsers with caterpillar-browser.",
"homepage": "https://github.com/bevry/caterpillar",
+ "license": {
+ "type": "MIT"
+ },
+ "badges": {
+ "travis": true,
+ "npm": true,
+ "gittip": "bevry",
+ "flattr": "344188/balupton-on-Flattr",
+ "paypal": "QB8GQPZAH84N6"
+ },
"keywords": [
"caterpillar",
"console",
@@ -32,6 +42,7 @@
"engines": {
"node": ">=0.8"
},
+ "browsers": true,
"dependencies": {
"extendr": "~2.1.0",
"readable-stream": "~1.1.9"
@@ -39,26 +50,20 @@
"devDependencies": {
"caterpillar-filter": "2.x",
"caterpillar-human": "2.x",
- "coffee-script": "~1.6.2",
+ "caterpillar-browser": "2.x",
+ "coffee-script": "~1.6.3",
"joe": "~1.3.0",
"joe-reporter-console": "~1.2.1",
- "chai": "~1.8.1"
+ "chai": "~1.8.1",
+ "projectz": "~0.3.0"
},
"directories": {
"lib": "./out/lib"
},
"scripts": {
- "test": "node ./out/test/caterpillar-test.js"
+ "test": "node ./out/test/caterpillar-test.js",
+ "browserify": "browserify -e example.js > example-browser.js",
+ "webpack": "webpack --progress --colors ./example.js example-browser.js"
},
- "main": "./out/lib/caterpillar.js",
- "license": {
- "type": "MIT"
- },
- "badges": {
- "travis": true,
- "npm": true,
- "gittip": "bevry",
- "flattr": "344188/balupton-on-Flattr",
- "paypal": "QB8GQPZAH84N6"
- }
+ "main": "./out/lib/caterpillar.js"
}
View
5 src/lib/caterpillar.coffee
@@ -1,6 +1,7 @@
# Import
extendr = require('extendr')
-stream = require('readable-stream')
+stream = require('stream')
+stream = require('readable-stream') if stream.Transform? is false
# Transform
class Transform extends stream.Transform
@@ -11,7 +12,7 @@ class Transform extends stream.Transform
@setConfig(opts)
super
- pipe: (child) ->
+ pipe: (child) =>
if child.setConfig?(@config) then @on('config', child.setConfig)
super
View
7 src/test/caterpillar-test.coffee
@@ -10,7 +10,7 @@ cleanChanging = (item) ->
item.date = item.date.replace(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/, 'date')
item.file = item.file.replace(/^[\/\\].+$/, 'file')
item.line = item.file.replace(/^\d{1,}$/, 'line')
- item.method = item.method.replace(/^[\d\w\.]+$/, 'method')
+ item.method = item.method.replace(/^[\d\w\.\_\-\<\>]+$/, 'method')
return item
# Test
@@ -85,10 +85,9 @@ joe.describe 'caterpillar', (describe,it) ->
it 'should provide the expected output', (done) ->
output.on 'end', ->
- #console.log actual
actual = actual.map(cleanChanging)
- expect(actual.length).to.equal(expected.length)
+ expect(actual.length, 'lengths').to.equal(expected.length)
for result,index in actual
- expect(result).to.deep.equal(expected[index])
+ expect(result, 'results').to.deep.equal(expected[index])
done()
logger.end()
Please sign in to comment.
Something went wrong with that request. Please try again.